palaeontology
Active Member
- Joined
- May 12, 2017
- Messages
- 444
- Office Version
- 2016
- Platform
- Windows
Hi, I'm currently using the following code to print pages 1 and 2 of any worksheet named with a 4-digit number ...
so, currently, if there are 6 worksheets named with a 4-digit code, each worksheet will have their page 1 and 2 printed.
However, my needs have now changed. Is there a way to have ....
* page 1 printed (in landscape) for each worksheet named with a 4-digit code
* page 1 printed (in landscape) for the worksheet named .... Explanations
PLEASE READ THIS NEXT BIT !
I need the 'Explanations' worksheet (page 1) only printed just the once, regardless of how many 4-digit worksheets are being printed.
That is, if there are seven (7) worksheets with a 4-digit name each having their page 1 printed, then there would be a total of eight (8) pages being printed, as the 'Explanations page only needs to be printed once.
I hope this makes sense.
Kind regards,
Chris
Code:
For Each ws In ThisWorkbook.Worksheets
If ws.Name Like "#####" Then
ws.Range("P22:U22").Font.Color = vbWhite
ws.Range("P22:U22").Interior.Color = vbWhite
ws.PageSetup.Orientation = xlLandscape
ws.PrintOut From:=1, To:=1
ws.PageSetup.Orientation = xlLandscape
ws.PrintOut From:=2, To:=2
End If
Next ws
so, currently, if there are 6 worksheets named with a 4-digit code, each worksheet will have their page 1 and 2 printed.
However, my needs have now changed. Is there a way to have ....
* page 1 printed (in landscape) for each worksheet named with a 4-digit code
* page 1 printed (in landscape) for the worksheet named .... Explanations
PLEASE READ THIS NEXT BIT !
I need the 'Explanations' worksheet (page 1) only printed just the once, regardless of how many 4-digit worksheets are being printed.
That is, if there are seven (7) worksheets with a 4-digit name each having their page 1 printed, then there would be a total of eight (8) pages being printed, as the 'Explanations page only needs to be printed once.
I hope this makes sense.
Kind regards,
Chris