R
rwong
Hi -
I'm trying to create a macro that allows me to print certain sheets
from a worksheet, whereby the names of the sheets I want to print are
contained in a range (ie "printrange")
I'm not very familiar with writing code but I tried to modify an
existing macro I had, which cycles through the sheets that I've listed
out in the range and prints it one by one (pls see below). What I
would like some help on, is to create a macro which effectively selects
multiple sheets and issues a print command. This is so that when I use
it to print PDF files, I don't get multiple PDF files. I just can't
figure out how to get the name of the sheets (which are not always the
same - ie may want to print out different pages of output) into an
array...
Thanks in advance!
Old macro:
Sub PrintMacro()
Dim PrintRange As Range
Set PrintRange = Range("SheetsToPrint")
confirm = InputBox("Are you sure? (enter 'y' to continue)")
If confirm <> "y" Then GoTo TheEnd
For Each X In PrintRange
If X.Value <> "" Then
Worksheets(X.Value).PrintOut Copies:=1, Collate:=True
End If
Next X
TheEnd:
End Sub

I'm trying to create a macro that allows me to print certain sheets
from a worksheet, whereby the names of the sheets I want to print are
contained in a range (ie "printrange")
I'm not very familiar with writing code but I tried to modify an
existing macro I had, which cycles through the sheets that I've listed
out in the range and prints it one by one (pls see below). What I
would like some help on, is to create a macro which effectively selects
multiple sheets and issues a print command. This is so that when I use
it to print PDF files, I don't get multiple PDF files. I just can't
figure out how to get the name of the sheets (which are not always the
same - ie may want to print out different pages of output) into an
array...
Thanks in advance!
Old macro:
Sub PrintMacro()
Dim PrintRange As Range
Set PrintRange = Range("SheetsToPrint")
confirm = InputBox("Are you sure? (enter 'y' to continue)")
If confirm <> "y" Then GoTo TheEnd
For Each X In PrintRange
If X.Value <> "" Then
Worksheets(X.Value).PrintOut Copies:=1, Collate:=True
End If
Next X
TheEnd:
End Sub