I'm trying to create a variable array and then use it in a sorting function. I am trying many different things to fix it, each time getting different errors. In a non-variable example, the bolded portion below reads TotalList:=Array(8,9,10,11,12,13,14). For this month, VehCol and LastColData are Integers 8 and 14 respectively. I need general array creation and implementation help. Thank you in advance.
''''''''''CODE START
Dim SubTotalColumns() As Integer
Dim n As Integer
For n = VehCol To LastColData
ReDim Preserve SubTotalColumns
SubTotalColumns
= n
Next n
Selection.Subtotal GroupBy:=7, Function:=xlSum, TotalList:=SubTotalColumns, Replace:=True, PageBreaks:=False, SummaryBelowData:=True
''''''''''CODE END
''''''''''CODE START
Dim SubTotalColumns() As Integer
Dim n As Integer
For n = VehCol To LastColData
ReDim Preserve SubTotalColumns
SubTotalColumns
Next n
Selection.Subtotal GroupBy:=7, Function:=xlSum, TotalList:=SubTotalColumns, Replace:=True, PageBreaks:=False, SummaryBelowData:=True
''''''''''CODE END