Macro - Print sheets between two marker sheets

RichJH

New Member
Joined
Sep 3, 2019
Messages
9
Hello,

I have multiple files with varying working and backup sheets but I would like to create a macro that will print the main group of tabs which will always vary in actual names.

My initial thought was to create marker workbooks named 'start' and 'end' for example that would mark the required tabs for ease of selection.

Can I create a macro (to link to button) that will select all the tabs between these to be ready for printing?

Cheers
 
Last edited:

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
My initial thought was to create marker workbooks named 'start' and 'end' for example that would mark the required tabs for ease of selection.

Can I create a macro (to link to button) that will select all the tabs between these to be ready for printing?
See if this does what you want.
Code:
Sub Select_Sheets()
  Dim i As Long
  
  Sheets(Sheets("start").Index + 1).Select
  For i = Sheets("start").Index + 2 To Sheets("end").Index - 1
    Sheets(i).Select Replace:=False
  Next i
End Sub
 
Upvote 0
See if this does what you want.
Code:
Sub Select_Sheets()
  Dim i As Long
  
  Sheets(Sheets("start").Index + 1).Select
  For i = Sheets("start").Index + 2 To Sheets("end").Index - 1
    Sheets(i).Select Replace:=False
  Next i
End Sub

Perfect thank you, what would the best way to unselect these sheets after printing, would like to prevent multiple sheet cells changes?
 
Upvote 0
Perfect thank you, what would the best way to unselect these sheets after printing, would like to prevent multiple sheet cells changes?
That is a very good idea. :)

Perhaps something like this
Rich (BB code):
Sub Select_Sheets()
  Dim i As Long
  
  Sheets(Sheets("start").Index + 1).Select
  For i = Sheets("start").Index + 2 To Sheets("end").Index - 1
    Sheets(i).Select Replace:=False
  Next i
  
  ActiveWindow.SelectedSheets.PrintOut
  
  Sheets(Sheets("start").Index + 1).Select Replace:=True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top