Printing sheet from list reference

RhodEvans

Board Regular
Joined
Oct 31, 2012
Messages
88
Morning, I am sure it is easy as I have done this before, but can't remember how or where I have put the code.I have a spreadsheet with multiple worksheets (The amount and names of sheets will keep changing). On a front sheet I have a dynamic validation list in cell "L9" that will always have the full list of spreadsheet names. The idea is that I will choose which spreadsheet to print from this list. Press a button and only that sheet will print. Any idea's, or any better Ideas on how to do it.You help and weath of knowledge is appreciated
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Try something like this...

Code:
Sub PrintSheetBasedOnDropDown()

With Sheets("ValidationSheetNameHere")
    Sheets(.Range(L9).Value).PrintOut Copies:=1, Collate:=True
End With

End Sub
 
Upvote 0
Thanks for the help, however on running the code, I get a '1004' Application-Defined or Object-defined error. The only thiing I can think of is: I have merged cells L9 & M9 together to make the validation drop down, does this make any difference to the code?Thanks again
 
Upvote 0
I should have noticed that!!! But, thanks. A nice bit of code, and I'm sure, far simpler than the one I used last time.
 
Upvote 0

Forum statistics

Threads
1,203,241
Messages
6,054,321
Members
444,717
Latest member
melindanegron

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