VBA Print Commands

PilotNinja

New Member
Joined
Mar 24, 2015
Messages
5
Hi everyone,

I come hat in hand again asking for help.

I am trying to incorporate some radio buttons and a print button into an excel worksheet. Ideally, the user would be able to click a radio button which would select a range of cells which the print button would then print.

For example, select the first radio button, lets call it "Shipping Label" then clicking print, would cause a group of cells containing all the info for a shipping label to print. The second label, lets call it "Return Address Label" would then print another set of cells containing the return address information.

I've linked radio buttons to cells and can make the linked cells return a value of either TRUE or FALSE, or different text, but I can't seem to figure out how to link that to what I want to print. Currently I have a print button for every of the 14 print options I need, but some radio buttons would really clean it up for me.

Any help would once again be greatly appreciated!

Thanks in advance.
 

Some videos you may like

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

V_Malkoti

Well-known Member
Joined
Jun 10, 2015
Messages
898
Code:
Sheets("SourceData").Range("$A$1:$S$36").PrintOut Copies:=1, Collate:=True

There are more options that you can set.
 

PilotNinja

New Member
Joined
Mar 24, 2015
Messages
5
V_Malkoti, Thanks for the response. I know how to make it print, but I am trying to make certain cell ranges print if a box is checked.

AlphaFrog, I am using ActiveX controls.

Thanks!
 

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,400

ADVERTISEMENT

This is one way to determine which of three ActiveX option buttons is selected.

Code:
[color=darkblue]Private[/color] [color=darkblue]Sub[/color] CommandButton1_Click()
    [color=darkblue]Select[/color] [color=darkblue]Case[/color] [color=darkblue]True[/color]
        [color=darkblue]Case[/color] Me.OptionButton1
            Me.Range("A1:B10").PrintOut Copies:=1, Collate:=[color=darkblue]True[/color]
        [color=darkblue]Case[/color] Me.OptionButton2
            Me.Range("D1:E10").PrintOut Copies:=1, Collate:=[color=darkblue]True[/color]
        [color=darkblue]Case[/color] Me.OptionButton3
            Me.Range("G1:H10").PrintOut Copies:=1, Collate:=[color=darkblue]True[/color]
    [color=darkblue]End[/color] [color=darkblue]Select[/color]
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
 

PilotNinja

New Member
Joined
Mar 24, 2015
Messages
5
AlphaFrog, you are awesome. That couldn't have worked any better. Thank you so much!
 

Watch MrExcel Video

Forum statistics

Threads
1,127,528
Messages
5,625,339
Members
416,096
Latest member
forevans

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
Top