Macro for printing from a drop down box

Tor!

New Member
Joined
Mar 15, 2011
Messages
5
Hi
I have created a drop down box from a validation list and need some help on the macro in order to automatically print the file details for each item in the drop down list.

Please can you advise how to do this - I am pretty new to macros.

Many thanks
Tor
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Welcome to the Board!

If you record a macro printing a few of the conditions you have, then post it here along with an explanation of how the conditions relate to your validation, we can help you set something up.
 
Upvote 0
This is the macro I've just done, I selected 3 different items from the drop down box - this is the bit I need it doing automatically. My list is in cell D6.

Thanks for your help

Sub Printer_macro()
'
' Printer_macro Macro
' Macro recorded 15/03/2011 by Victoria Lourensz
'
'
Range("A1:J118").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$J$118"
ActiveWindow.SmallScroll Down:=-3
Range("D6").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1
ActiveWindow.SelectedSheets.PrintOut Copies:=1
ActiveWindow.SelectedSheets.PrintOut Copies:=1
End Sub
 
Upvote 0
OK, a few questions:

1) The Data Validation is in D6, but where's the source?
2) Assuming that the Print Area changes for each selection, what are they? (E.G. Selection 1 = Range("A1:J118")).

Have you thought of setting up some Custom Views? If so this may be helpful: http://support.microsoft.com/kb/291072
 
Upvote 0
It is linked to the next worksheet I've created a data range. The print range will be the same regardless of what is selected from the drop down box.

Thanks for the link - this website is blocked by work though!
 
Upvote 0
OK, so now I'm assuming that your list selections drive some changes on the sheet. If that's the case then you can loop through each selection, print and move on to the next. Something like this:

<font face=Calibri><SPAN style="color:#00007F">Sub</SPAN> PrintfromDVList()<br>    <SPAN style="color:#00007F">Dim</SPAN> ws <SPAN style="color:#00007F">As</SPAN> Worksheet<br>    <SPAN style="color:#00007F">Dim</SPAN> i <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN><br>    <br>    <SPAN style="color:#00007F">Set</SPAN> ws = Sheets("Sheet2")<br>    <br>        <SPAN style="color:#00007F">For</SPAN> i = 1 <SPAN style="color:#00007F">To</SPAN> ws.Cells(Rows.Count, "A").End(xlUp).Row<br>            <SPAN style="color:#00007F">With</SPAN> Sheets("Sheet1")<br>                .Range("D6").Value = ws.Cells(i, "A").Value<br>                .PrintPreview <SPAN style="color:#007F00">' Change to PrintOut after testing</SPAN><br>            <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br>        <SPAN style="color:#00007F">Next</SPAN> i<br>            <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

Where Sheet2 is the Data Validation source sheet and the list is in Column A with no headers, and Sheet1 is the sheet to print.
 
Upvote 0

Forum statistics

Threads
1,214,631
Messages
6,120,640
Members
448,974
Latest member
DumbFinanceBro

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