Recording a Macro with a Validation List

zburns

New Member
Joined
Dec 4, 2012
Messages
8
I have to prepare 70+ tables from a data set. In order to take the same information from the data set, I have created a validation list dropdown (in cell A2). The next step (that I need help with) is recording a macro that prints the first table, then selects the next item on the list and prints that table, continuing until all 70 table are printed.

I tried to record the macro, but the macro won't select the following item on the list before printing. Does anyone know how to edit the macro to do this?

Thank you for your help!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I think that is what I tried, but when I ran the macro, the same item on the list printed over again, rather than the next item. Also, when I recorded the macro, I printed as far as the third item on the list; I need the macro to continue running until it has cycled through all of the items on the list.
 
Upvote 0
This is the code for the macro I recorded. I don't know enough about coding macros to be able to change it however... any more help is much appreciated.

Sub TablePrint()
'
' TablePrint Macro
' Switch to next table, then print.
'

'
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
Range("A2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
End Sub
 
Upvote 0
Try:

Code:
Sub TablePrint()
    Dim Cell As Range
    For Each Cell In Range("AF2:AF78")
        Range("A2").Value = Cell.Value
        ActiveSheet.PrintOut
    Next Cell
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,098
Messages
6,170,103
Members
452,302
Latest member
TaMere

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