Reputation: 13920
During execution of macro I reads multiple excel file and creates a new excel file, i build a similar sheet:
At runtime by VBA I want to set this area and create a table, add Total Row and get the following result:
Thank you :-)
Upvotes: 0
Views: 735
Reputation: 4974
Like this:
Range("A1:I9").Select
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$I$9"), , xlYes).Name = "Table1"
ActiveSheet.ListObjects("Table1").ShowTotals = True
ActiveSheet.ListObjects("Table1").ListColumns("B").TotalsCalculation = xlTotalsCalculationSum
ActiveSheet.ListObjects("Table1").ListColumns("C").TotalsCalculation = xlTotalsCalculationSum
'Repeat row above until column I
I got this by recording a VBA Macro. If you are not familiar with Macro recording see link here.
Upvotes: 1