Printing problem

litestream

Active Member
Joined
Jul 24, 2006
Messages
323
I have a user form with 4 check boxes - one for each of 4 areas on the same worksheet. When I check a box and press the command button, one of the 4 areas is printed.

I'd like to be able to add the areas (for example, checking boxes 1 and 3 would result in the ranges a3:c18 and a21:c36 being printed on the same page.

Here is the code I am using:
Code:
Private Sub CommandButton1_Click() 
If CheckBox1.Value = True Then 
Sheets("MON").Range("a3:c18").PrintOut 
End If 
If CheckBox2.Value = True Then 
Sheets("MON").Range("e3:g18").PrintOut 
End If 
If CheckBox3.Value = True Then 
Sheets("MON").Range("a21:c36").PrintOut 
End If 
If CheckBox4.Value = True Then 
Sheets("MON").Range("e21:g36").PrintOut 
End If 
UserForm1.Hide 
End Sub

Any assistance would be greatly appreciated
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hi,

hiding rows or columns would work if some combinations can't occur
these would be a problem
1& 4
2 & 3

if all combinations can occur there are some options
1. easiest
change your layout and put all areas vertically
setting overall printarea + hide rows would do the job
2.
a copy of those data in another location in vertical layout like option 1. printout this copy hiding rows ...
3. more code
temporary sheet which gets data
printout
delete sheet

kind regards,
Erik
 

Forum statistics

Threads
1,136,347
Messages
5,675,235
Members
419,555
Latest member
Paddington

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