I am trying to use a VBA macro to set Excel's Print Range that varies each time the macro is run. The code looks like the following:
For i = 0 to 50
PrRng = PrRng & "," & "AI" & 2 + 175 * i & ":" & "AU" & 65 + 175 * i _
& "," & "AI" & 68 + 175 * iMkt & ":" & "AU" & 131 + 175 * i
next i
With ActiveSheet.PageSetup
.PrintArea = PrRng
End With
As you can see, the string variable "PrRng" can get quite large. In fact, so large that Excel's PrintArea apparently cannot handle the length of the variable so I get an error message.
Can anyone think of a work around or a trick to get PrintArea to accept a very large string variable? I am trying to print out a large report with page numbers.
Thank you for any help.
For i = 0 to 50
PrRng = PrRng & "," & "AI" & 2 + 175 * i & ":" & "AU" & 65 + 175 * i _
& "," & "AI" & 68 + 175 * iMkt & ":" & "AU" & 131 + 175 * i
next i
With ActiveSheet.PageSetup
.PrintArea = PrRng
End With
As you can see, the string variable "PrRng" can get quite large. In fact, so large that Excel's PrintArea apparently cannot handle the length of the variable so I get an error message.
Can anyone think of a work around or a trick to get PrintArea to accept a very large string variable? I am trying to print out a large report with page numbers.
Thank you for any help.