Printing solution

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have group box with five option buttons, let's say they are called 1,2,3,4
and 5. Then I also have a button named Print. I would like to give the user
the opportunity to choose one of the option buttons and then press Print so
the particular sheet/part of sheet named in the option button gets printed.
Does anyone know VBA code for how to do this?

Would appreciate it!!

Andreas
 
Do you use Forms Option buttons ?

In the properties set a linked cell
Check the value of the cell in your code
 
Thanks for all your help Ron, the last row code looks very promising. However
I do not understand what you mean here, I do not have any code yet just form
option buttons inside a group box and then a button which says print. I would
like the user to be able to choose between 5 different print alternatives by
using the option buttons and after they've choosen an alternative being abl
to push the print button and then it prints. I know how to do a macro and
assign it directly to a button for printing but that reduces the flexibility
in what to print too much. Any ideas?
Thanks again
 
I add a few Option buttons from the Form toolbar on my worksheet (Sheet1)
My sheet are named Sheet1, Sheet2, ........., sheet5

If you right click on one of the option buttons choose format control
set a linked cell, for example A1.
The other option buttons have the same linked cell now.

Click on them and you see the value change in A1

Now add a button from the forms button on your worksheet
And assign this macro

Sub test()
Sheets("Sheet" & Sheets("Sheet1").Range("A1").Value).PrintOut preview:=True
End Sub

Delete
preview:=True

When it is working correct
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top