Command Button

sprigelz

Board Regular
Joined
Jan 7, 2016
Messages
98
Office Version
  1. 365
Platform
  1. Windows
Good day,

I am looking to get a button to press that will cycle through a dropdown list and print. For example, on Sheet "Hourly" I have a print area set. The dropdown is in J2. There are roughly 50 items in the dropdown.

I want the button to be able to go through each listed item in the dropdown and print off the results from the Print area. The Print area is all formulated to change when the dropdown selection is changed.

Example;
Dropdown List - 21,40,75,82

I want it to cycle through and do the following;
21,print,40,print,75,print,82,print

Is this possible?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Re: Command Button Help

How is the dropdown list populated? Is there a reference to a Range of cells that has the list?
 
Upvote 0
Re: Command Button Help

It is a defined name from a Pivot Table
 
Upvote 0
Re: Command Button Help

Run this macro on the sheet that contains the dropdown list

Code:
Sub Macro1()
    Dim r As Range
    For Each r In Range(Range("J2").Validation.Formula1)
        Range("J2").Value = r.Value
        Sheets("Hourly").PrintOut
    Next
End Sub
 
Upvote 0
Solution
Re: Command Button Help

I will try this first thing on Monday. Thank you!!
 
Upvote 0

Forum statistics

Threads
1,214,424
Messages
6,119,407
Members
448,894
Latest member
spenstar

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