- Joined
- Mar 30, 2006
- Messages
- 2
- Reaction score
- 0
I have 12 charts on a spreadsheet, but the number can vary. I want to print each chart on a separate page. Instead of setting up 12 print routines, I'd like to set up 1 routine with variable start cell and end cell settings. The starting row of each chart is offset by 22 rows from the one before it.
I have:
The Select line executes but I get an error on the last line of code, where I try to set the PrintArea to my Selection.
The error is: "Unable to set the PrintArea property of the PageSetup class"
Can anyone explain how I can achieve my goal of using variable references?
Thank you!
I have:
Code:
Public Sub PrintCharts()
Dim StartCol As String
Dim EndCol As String
Dim StartRow As Single
Dim EndRow As Single
Dim Offset as Single
'Initialize:
StartCol = "A"
EndCol = "G"
StartRow = 1
EndRow = 21
Offset = 22
'Navigate to correct spreadsheet:
Sheets("ChartPage").Select
Range(Cells(StartRow, StartCol), Cells(EndRow, EndCol)).Select
ActiveSheet.PageSetup.PrintArea = Selection
...
The Select line executes but I get an error on the last line of code, where I try to set the PrintArea to my Selection.
The error is: "Unable to set the PrintArea property of the PageSetup class"
Can anyone explain how I can achieve my goal of using variable references?
Thank you!