- My Forums
- Tiger Rant
- LSU Recruiting
- SEC Rant
- Saints Talk
- Pelicans Talk
- More Sports Board
- Fantasy Sports
- Golf Board
- Soccer Board
- O-T Lounge
- Tech Board
- Home/Garden Board
- Outdoor Board
- Health/Fitness Board
- Movie/TV Board
- Book Board
- Music Board
- Political Talk
- Money Talk
- Fark Board
- Gaming Board
- Travel Board
- Food/Drink Board
- Ticket Exchange
- TD Help Board
Customize My Forums- View All Forums
- Show Left Links
- Topic Sort Options
- Trending Topics
- Recent Topics
- Active Topics
Started By
Message
VBA code to Select multiple sheets and print
Posted on 4/6/20 at 11:09 am
Posted on 4/6/20 at 11:09 am
I'm looking to have a print button that brings up a listbox, which will then have selections that determine which sheets need to be selected. After selected, I want print PDF them all as 1 book.
Every time I think I figure out a solution, it only selects 1 sheet, rather than all of them.
Lets just call it the following
Sheet13
Sheet14
Sheet15
Sheet16
What I tried was:
FYI, I am only trying to figure out the initial code. Once I get that, I'll work it into my listbox variables.
Every time I think I figure out a solution, it only selects 1 sheet, rather than all of them.
Lets just call it the following
Sheet13
Sheet14
Sheet15
Sheet16
What I tried was:
quote:
Private Sub cbPrintBook_Click
Sheet13.Select
Sheet14.Select
Sheet15.Select
Sheet16.Select
ActiveWindow.SelectSheets.printout
End Sub
FYI, I am only trying to figure out the initial code. Once I get that, I'll work it into my listbox variables.
This post was edited on 4/6/20 at 11:10 am
Posted on 4/6/20 at 11:19 am to VermilionTiger
Ended up doing it by doing the tried and true method of VBA.. recording a macro and stealing the code
Private Sub cbPrintBook_Click()
Sheets(Array("Sheet13", "Sheet14")).Select
Sheets("Sheet13").Activate
ActiveWindow.SelectedSheets.PrintOut
End Sub
Private Sub cbPrintBook_Click()
Sheets(Array("Sheet13", "Sheet14")).Select
Sheets("Sheet13").Activate
ActiveWindow.SelectedSheets.PrintOut
End Sub
Posted on 4/6/20 at 7:43 pm to VermilionTiger
quote:
Ended up doing it by doing the tried and true method of VBA.. recording a macro and stealing the code
My go to.
Popular
Back to top
1






