Hi
Below is the code, I don't understand what Totcolumns(i-2)=i does. Is Totcolumns an array? What is its purpose? And I also don't understand TotalList = TotColumns either. Could you please explain? Thanks!!
' Add subtotals
FinalCol = Cells(3, 255).End(xlToLeft).Column
ReDim Preserve TotColumns(1 To FinalCol - 2)
For i = 3 To FinalCol
TotColumns(i - 2) = i
Next i
Selection.Subtotal GroupBy:=1, Function:=xlSum, _
TotalList:=TotColumns, Replace:=True, _
PageBreaks:=True, SummaryBelowData:=True
Below is the code, I don't understand what Totcolumns(i-2)=i does. Is Totcolumns an array? What is its purpose? And I also don't understand TotalList = TotColumns either. Could you please explain? Thanks!!
' Add subtotals
FinalCol = Cells(3, 255).End(xlToLeft).Column
ReDim Preserve TotColumns(1 To FinalCol - 2)
For i = 3 To FinalCol
TotColumns(i - 2) = i
Next i
Selection.Subtotal GroupBy:=1, Function:=xlSum, _
TotalList:=TotColumns, Replace:=True, _
PageBreaks:=True, SummaryBelowData:=True