ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Printing solution (https://www.excelbanter.com/excel-programming/394731-printing-solution.html)

Andreas

Printing solution
 
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

Ron de Bruin

Printing solution
 
Do you use Forms Option buttons ?

In the properties set a linked cell
Check the value of the cell in your code




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Andreas" wrote in message ...
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


Andreas

Printing solution
 
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

"Ron de Bruin" wrote:

Do you use Forms Option buttons ?

In the properties set a linked cell
Check the value of the cell in your code




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Andreas" wrote in message ...
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



Ron de Bruin

Printing solution
 
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



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Andreas" wrote in message ...
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

"Ron de Bruin" wrote:

Do you use Forms Option buttons ?

In the properties set a linked cell
Check the value of the cell in your code




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Andreas" wrote in message ...
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




All times are GMT +1. The time now is 05:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com