View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Printing certain pages

Private Sub PrintWIPButton_Click()
Dim bReplace As Boolean
Dim SheetNum As Integer
bReplace = True
For SheetNum = 1 To Worksheets.Count

If Sheets(SheetNum).Name Like "WIP*" Then
Sheets(SheetNum).Select bReplace
bReplace = False
End If

Next SheetNum
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

Worksheets(1).Select

End Sub

--
Regards,
Tom Ogilvy


"Nick Shinkins" wrote in message
...
A rather simple problem but I can't find what I want in help.

I wish to loop through each sheet in the workbook and print those called

WIP*

I was think of somethig like:

Private Sub PrintWIPButton_Click()

Dim SheetNum As Integer

For SheetNum = 1 To Worksheets.Count

If Sheets(SheetNum).Name Like "WIP*" Then

!!!! Add to a collection (or array?) of sheets !!!!

End If

Next SheetNum

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

Worksheets(1).Select

End Sub

---------------------------------

I'm just having problems in defining a collection of sheets.

Can anyone fill in the missing line of code??

TIA!

Nick Shinkins