Hello,
I have a workbook with a worksheet that lists worksheets names a user has selected from a userform for printing. The worksheets the user selected are in a named range, "PrintSheets". With VBA, I am trying to figure out how to print each of the sheets listed in "PrintSheets". Any suggestions?
Thank you very much!
Last edited by learning_vba; 11-04-2011 at 11:22 AM. Reason: Solved thanks to mojo249
You should be able to just print the named range:
Range("PrintSheets").PrintOut
I don't see the difference. Unless the range referred to in "PrintSheets" is less than the used range. In which case, why don't you set the named range to be whatever range you want to print out? Isn't that the point of having "PrintSheets"?
It is not the range that I want printed out. Each cell in the named range is the name of a particular worksheet. So I want to print out each worksheet that is listed in the named range. Perhaps I am going about this the wrong way. Let me better explain what I have done thus far and perhaps I may need to change the way I have it setup.
I have a userform that contains a multiselect listbox that is populated with all the worksheet names in the workbook. I want the user to select whichever worksheets they want to print, and then have those and only those print. The way I thought I would do this is by taking the worksheets selected by the user in the userfomr listbox, and then output those selections to a temporary holding worksheet. Then I name the range with the worksheet names, and then somehow use that named range to print the individual sheets. Does this sound like a good method of doing this?
Thanks.
Ah I see. Try this
For Each x In Range("PrintSheets") Sheets(x.Value).PrintOut Next x
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks