I have written a macros to take a worksheet and print it to PDF based on the index number in cell AQ1. The macros works fine, however; I want to be able to print to pdf for over 100 index numbers. I don't want to have to list out every number where I have Array. I was testing the macros using Array(1,2,3,4) and it works fine but now i want to replace that and find a way to tell it to print from 1-120 without typing each number in Array. How else can I do this? Here is the macros that I have:
Sub PDFTest()
Dim vars As Variant, i As Long
vars = Array(1, 2, 3, 4)
For i = LBound(vars) To UBound(vars)
[AQ1] = vars(i)
s = Range ("B2").Value
ChDir ActiveWorkbook.Path & "\"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=
s, Quality:=xlQualityStandard, From:=1, To:=1, IncludeDocProperites_
:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Next i
End Sub
Sub PDFTest()
Dim vars As Variant, i As Long
vars = Array(1, 2, 3, 4)
For i = LBound(vars) To UBound(vars)
[AQ1] = vars(i)
s = Range ("B2").Value
ChDir ActiveWorkbook.Path & "\"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=
s, Quality:=xlQualityStandard, From:=1, To:=1, IncludeDocProperites_
:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Next i
End Sub