Demo entry 6682809

sd

   

Submitted by anonymous on Dec 11, 2017 at 04:40
Language: VB.net. Code size: 1.1 kB.

    'Calculate the total revenue
     With wksheetReport
         .Range("a1").End(xlDown).Offset(2, 0).Value = "Total"                     'Heading row name
         .Range("B1").End(xlDown).Offset(2, 0).Value = _
              WorksheetFunction.Sum(Range(.Range("b1"), .Range("b1").End(xlDown))) 'Total Revenue
     End With
    
    'Enhance the layout of the whsheetReport
    '*********************************************************************************************
     For Each CellReport In wksheetReport.Range("b1", wksheetReport.Range("b1048576").End(xlUp))
       
        'Set the format of a numeric cell
        If VBA.IsNumeric(CellReport.Value) = True Then CellReport.NumberFormat = "$#,##0.00"
        
     Next CellReport
     
    'Adjust the column widths
     wksheetReport.Range("a1").CurrentRegion.Columns.AutoFit

    'Sort the CustomerID in ascending order
     wksheetReport.Range("A1").CurrentRegion.Sort Key1:=wksheetReport.Columns(1), _
                                                  Order1:=xlAscending, Header:=xlYes

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).