• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 286
  • Last Modified:

Excel .Printout using a variable

I have 2 command buttons, one to print all of the worksheets in a workbook, and another to print the worksheets the user has selected in a multiselect listbox. The Print All code works fine: Worksheets(Array("ActCorpCkReq", "KSI Check req", "NON_VEBA Reti East Ck Req","Retirees VPS")).PrintOut

The second, I am looping through the selected items of the listbox and capturing them in a string separated by commas. So the string might look like "KSI Check req","Retirees VPS"
I want to do something like
Worksheets(Array(strSelected).printout, but I am getting error subscript out of range.
1 Solution
smm6809Author Commented:
Any help out there?
Richard DanekeCommented:
To print the selected sheets, either group the sheets and print active sheets (default) or loop through the multi select and selet each worksheet, print, select the next worksheet, print, ....
Another option would be to create print views and to print the view based on the selection, but, with multi-select you would need all possible combinations.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now