ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print Box (https://www.excelbanter.com/excel-programming/300493-print-box.html)

Jordon

Print Box
 
Can someone please help. I need to create a box that pops up after pressing a button in Excel that gives the user check boxes to choose which areas to print. Eg. I choose check box 1...it previews area 1, I choose check box 2...it previews area 2. I admit I am not sure where to start, so if someone out there has a complete sample for displaying a print area choose box and displays that print choice
Thanks for the help

Ron de Bruin

Print Box
 
Hi Jordon

Read this first
http://support.microsoft.com/default...b;EN-US;829070

If you use a userform and add option buttons on it you can
use this code in the userform module to do what you want.

Private Sub OptionButton1_Click()
Unload Me
Range("A1:A10").PrintPreview
End Sub

Private Sub OptionButton2_Click()
Unload Me
Range("B1:b10").PrintPreview
End Sub

Private Sub OptionButton3_Click()
Unload Me
Range("C1:C10").PrintPreview
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Can someone please help. I need to create a box that pops up after pressing a button in Excel that gives the user check boxes to

choose which areas to print. Eg. I choose check box 1...it previews area 1, I choose check box 2...it previews area 2. I admit I
am not sure where to start, so if someone out there has a complete sample for displaying a print area choose box and displays that
print choice.
Thanks for the help




Jordon

Print Box
 
Perfect! Thanks...this is very helpful

----- Ron de Bruin wrote: ----

Hi Jordo

Read this firs
http://support.microsoft.com/default...kb;EN-US;82907

If you use a userform and add option buttons on it you ca
use this code in the userform module to do what you want

Private Sub OptionButton1_Click(
Unload M
Range("A1:A10").PrintPrevie
End Su

Private Sub OptionButton2_Click(
Unload M
Range("B1:b10").PrintPrevie
End Su

Private Sub OptionButton3_Click(
Unload M
Range("C1:C10").PrintPrevie
End Su


--
Regards Ron de Brui
http://www.rondebruin.n


"Jordon" wrote in message ..
Can someone please help. I need to create a box that pops up after pressing a button in Excel that gives the user check boxes t

choose which areas to print. Eg. I choose check box 1...it previews area 1, I choose check box 2...it previews area 2. I admit
am not sure where to start, so if someone out there has a complete sample for displaying a print area choose box and displays tha
print choice
Thanks for the hel





Jordon

Print Box
 
Thanks Ron! One more curve....How can I add check boxes and allow user to select more than one check box which in turn previews multiple print areas? In other words the user checks box 1 and box 2...hits the "OK" button and it previews both of those print areas
Thanks in advance

Ron de Bruin

Print Box
 
Hi Jordon

Add three checkboxes on your userform and one button.
Try this code for the button

Private Sub CommandButton1_Click()
Dim Num As Integer
Num = Abs(CheckBox1.Value) * 1 + _
Abs(CheckBox2.Value) * 3 + _
Abs(CheckBox3.Value) * 5

Select Case Num
Case 1
MsgBox "Run the code for checkbox 1"
Case 3
MsgBox "Run the code for checkbox 2"
Case 5
MsgBox "Run the code for checkbox 3"
Case 4
MsgBox "Run the code for checkbox 1 + 2"
Case 9
MsgBox "Run the code for checkbox 1 + 2 + 3"
Case 6
MsgBox "Run the code for checkbox 1 + 3"
Case 8
MsgBox "Run the code for checkbox 2 + 3"
End Select
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Thanks Ron! One more curve....How can I add check boxes and allow user to select more than one check box which in turn previews

multiple print areas? In other words the user checks box 1 and box 2...hits the "OK" button and it previews both of those print
areas.
Thanks in advance




Jordon

Print Box
 
Thanks again Ron! Great help! Sorry to keep on, but when I add the print preview code after say the first check box...it works, previews, but the userform stay on top and does not let me get out of it. Is there a way to close the userform after confirming selection? Thanks again in advance

----- Ron de Bruin wrote: ----

Hi Jordo

Add three checkboxes on your userform and one button
Try this code for the butto

Private Sub CommandButton1_Click(
Dim Num As Intege
Num = Abs(CheckBox1.Value) * 1 +
Abs(CheckBox2.Value) * 3 +
Abs(CheckBox3.Value) *

Select Case Nu
Case
MsgBox "Run the code for checkbox 1
Case
MsgBox "Run the code for checkbox 2
Case
MsgBox "Run the code for checkbox 3
Case
MsgBox "Run the code for checkbox 1 + 2
Case
MsgBox "Run the code for checkbox 1 + 2 + 3
Case
MsgBox "Run the code for checkbox 1 + 3
Case
MsgBox "Run the code for checkbox 2 + 3
End Selec
End Su


--
Regards Ron de Brui
http://www.rondebruin.n


"Jordon" wrote in message ..
Thanks Ron! One more curve....How can I add check boxes and allow user to select more than one check box which in turn preview

multiple print areas? In other words the user checks box 1 and box 2...hits the "OK" button and it previews both of those prin
areas
Thanks in advanc





Ron de Bruin

Print Box
 
Hi Jordon

You must Unload the Userform first

like this

Case 1
Unload Me
Range("A1:A10").PrintPreview
Case 3
Unload Me
Range("B1:B10").PrintPreview
Case 5
Unload Me
Range("C1:C10").PrintPreview
Case 4
Unload Me
Range("A1:A10").PrintPreview
Range("B1:B10").PrintPreview


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Thanks again Ron! Great help! Sorry to keep on, but when I add the print preview code after say the first check box...it works,

previews, but the userform stay on top and does not let me get out of it. Is there a way to close the userform after confirming
selection? Thanks again in advance.

----- Ron de Bruin wrote: -----

Hi Jordon

Add three checkboxes on your userform and one button.
Try this code for the button

Private Sub CommandButton1_Click()
Dim Num As Integer
Num = Abs(CheckBox1.Value) * 1 + _
Abs(CheckBox2.Value) * 3 + _
Abs(CheckBox3.Value) * 5

Select Case Num
Case 1
MsgBox "Run the code for checkbox 1"
Case 3
MsgBox "Run the code for checkbox 2"
Case 5
MsgBox "Run the code for checkbox 3"
Case 4
MsgBox "Run the code for checkbox 1 + 2"
Case 9
MsgBox "Run the code for checkbox 1 + 2 + 3"
Case 6
MsgBox "Run the code for checkbox 1 + 3"
Case 8
MsgBox "Run the code for checkbox 2 + 3"
End Select
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Thanks Ron! One more curve....How can I add check boxes and allow user to select more than one check box which in turn

previews
multiple print areas? In other words the user checks box 1 and box 2...hits the "OK" button and it previews both of those

print
areas.
Thanks in advance







JORDON

Print Box
 
Hi Ron,
Sorry again...this works, however..I need to have each checkbox choice show up together on the print preview instead of having to "close" the print preview to go to the next print area. In other words, the user selects box 1 & 2...the preview window has the option of clicking on "next" to go to the next choice. Can you help me write the code for this?
Thanks

"Ron de Bruin" wrote:

Hi Jordon

You must Unload the Userform first

like this

Case 1
Unload Me
Range("A1:A10").PrintPreview
Case 3
Unload Me
Range("B1:B10").PrintPreview
Case 5
Unload Me
Range("C1:C10").PrintPreview
Case 4
Unload Me
Range("A1:A10").PrintPreview
Range("B1:B10").PrintPreview


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Thanks again Ron! Great help! Sorry to keep on, but when I add the print preview code after say the first check box...it works,

previews, but the userform stay on top and does not let me get out of it. Is there a way to close the userform after confirming
selection? Thanks again in advance.

----- Ron de Bruin wrote: -----

Hi Jordon

Add three checkboxes on your userform and one button.
Try this code for the button

Private Sub CommandButton1_Click()
Dim Num As Integer
Num = Abs(CheckBox1.Value) * 1 + _
Abs(CheckBox2.Value) * 3 + _
Abs(CheckBox3.Value) * 5

Select Case Num
Case 1
MsgBox "Run the code for checkbox 1"
Case 3
MsgBox "Run the code for checkbox 2"
Case 5
MsgBox "Run the code for checkbox 3"
Case 4
MsgBox "Run the code for checkbox 1 + 2"
Case 9
MsgBox "Run the code for checkbox 1 + 2 + 3"
Case 6
MsgBox "Run the code for checkbox 1 + 3"
Case 8
MsgBox "Run the code for checkbox 2 + 3"
End Select
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Thanks Ron! One more curve....How can I add check boxes and allow user to select more than one check box which in turn

previews
multiple print areas? In other words the user checks box 1 and box 2...hits the "OK" button and it previews both of those

print
areas.
Thanks in advance








Ron de Bruin

Print Box
 
Hi Jordon

Sorry again

No problem

Use this
Range("A1:A10,B1:B10").PrintPreview
or
Range("A1:A10,B1:B10,C1:C10").PrintPreview




--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Hi Ron,
Sorry again...this works, however..I need to have each checkbox choice show up together on the print preview instead of having

to "close" the print preview to go to the next print area. In other words, the user selects box 1 & 2...the preview window has the
option of clicking on "next" to go to the next choice. Can you help me write the code for this?
Thanks

"Ron de Bruin" wrote:

Hi Jordon

You must Unload the Userform first

like this

Case 1
Unload Me
Range("A1:A10").PrintPreview
Case 3
Unload Me
Range("B1:B10").PrintPreview
Case 5
Unload Me
Range("C1:C10").PrintPreview
Case 4
Unload Me
Range("A1:A10").PrintPreview
Range("B1:B10").PrintPreview


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Thanks again Ron! Great help! Sorry to keep on, but when I add the print preview code after say the first check box...it

works,
previews, but the userform stay on top and does not let me get out of it. Is there a way to close the userform after confirming
selection? Thanks again in advance.

----- Ron de Bruin wrote: -----

Hi Jordon

Add three checkboxes on your userform and one button.
Try this code for the button

Private Sub CommandButton1_Click()
Dim Num As Integer
Num = Abs(CheckBox1.Value) * 1 + _
Abs(CheckBox2.Value) * 3 + _
Abs(CheckBox3.Value) * 5

Select Case Num
Case 1
MsgBox "Run the code for checkbox 1"
Case 3
MsgBox "Run the code for checkbox 2"
Case 5
MsgBox "Run the code for checkbox 3"
Case 4
MsgBox "Run the code for checkbox 1 + 2"
Case 9
MsgBox "Run the code for checkbox 1 + 2 + 3"
Case 6
MsgBox "Run the code for checkbox 1 + 3"
Case 8
MsgBox "Run the code for checkbox 2 + 3"
End Select
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message

...
Thanks Ron! One more curve....How can I add check boxes and allow user to select more than one check box which in

turn
previews
multiple print areas? In other words the user checks box 1 and box 2...hits the "OK" button and it previews both of

those
print
areas.
Thanks in advance









JORDON

Print Box
 
Thanks! Below is the code I am using. It works when I select one check box...however when I choose 2 check boxes the "ok" button does not do anything...can you assist? Basically what I would like to do is enable the user to select 2 boxes and have those print areas show up as two pages in the print preview screen. The areas to print are on different pages.
Thanks

"Ron de Bruin" wrote:

Hi Jordon

Sorry again

No problem

Use this
Range("A1:A10,B1:B10").PrintPreview
or
Range("A1:A10,B1:B10,C1:C10").PrintPreview




--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Hi Ron,
Sorry again...this works, however..I need to have each checkbox choice show up together on the print preview instead of having

to "close" the print preview to go to the next print area. In other words, the user selects box 1 & 2...the preview window has the
option of clicking on "next" to go to the next choice. Can you help me write the code for this?
Thanks

"Ron de Bruin" wrote:

Hi Jordon

You must Unload the Userform first

like this

Case 1
Unload Me
Range("A1:A10").PrintPreview
Case 3
Unload Me
Range("B1:B10").PrintPreview
Case 5
Unload Me
Range("C1:C10").PrintPreview
Case 4
Unload Me
Range("A1:A10").PrintPreview
Range("B1:B10").PrintPreview


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Thanks again Ron! Great help! Sorry to keep on, but when I add the print preview code after say the first check box...it

works,
previews, but the userform stay on top and does not let me get out of it. Is there a way to close the userform after confirming
selection? Thanks again in advance.

----- Ron de Bruin wrote: -----

Hi Jordon

Add three checkboxes on your userform and one button.
Try this code for the button

Private Sub CommandButton1_Click()
Dim Num As Integer
Num = Abs(CheckBox1.Value) * 1 + _
Abs(CheckBox2.Value) * 3 + _
Abs(CheckBox3.Value) * 5

Select Case Num
Case 1
MsgBox "Run the code for checkbox 1"
Case 3
MsgBox "Run the code for checkbox 2"
Case 5
MsgBox "Run the code for checkbox 3"
Case 4
MsgBox "Run the code for checkbox 1 + 2"
Case 9
MsgBox "Run the code for checkbox 1 + 2 + 3"
Case 6
MsgBox "Run the code for checkbox 1 + 3"
Case 8
MsgBox "Run the code for checkbox 2 + 3"
End Select
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message

...
Thanks Ron! One more curve....How can I add check boxes and allow user to select more than one check box which in

turn
previews
multiple print areas? In other words the user checks box 1 and box 2...hits the "OK" button and it previews both of

those
print
areas.
Thanks in advance










Ron de Bruin

Print Box
 
I don't see your code

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Thanks! Below is the code I am using. It works when I select one check box...however when I choose 2 check boxes the "ok" button

does not do anything...can you assist? Basically what I would like to do is enable the user to select 2 boxes and have those print
areas show up as two pages in the print preview screen. The areas to print are on different pages.
Thanks

"Ron de Bruin" wrote:

Hi Jordon

Sorry again

No problem

Use this
Range("A1:A10,B1:B10").PrintPreview
or
Range("A1:A10,B1:B10,C1:C10").PrintPreview




--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Hi Ron,
Sorry again...this works, however..I need to have each checkbox choice show up together on the print preview instead of

having
to "close" the print preview to go to the next print area. In other words, the user selects box 1 & 2...the preview window has

the
option of clicking on "next" to go to the next choice. Can you help me write the code for this?
Thanks

"Ron de Bruin" wrote:

Hi Jordon

You must Unload the Userform first

like this

Case 1
Unload Me
Range("A1:A10").PrintPreview
Case 3
Unload Me
Range("B1:B10").PrintPreview
Case 5
Unload Me
Range("C1:C10").PrintPreview
Case 4
Unload Me
Range("A1:A10").PrintPreview
Range("B1:B10").PrintPreview


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Thanks again Ron! Great help! Sorry to keep on, but when I add the print preview code after say the first check box...it

works,
previews, but the userform stay on top and does not let me get out of it. Is there a way to close the userform after

confirming
selection? Thanks again in advance.

----- Ron de Bruin wrote: -----

Hi Jordon

Add three checkboxes on your userform and one button.
Try this code for the button

Private Sub CommandButton1_Click()
Dim Num As Integer
Num = Abs(CheckBox1.Value) * 1 + _
Abs(CheckBox2.Value) * 3 + _
Abs(CheckBox3.Value) * 5

Select Case Num
Case 1
MsgBox "Run the code for checkbox 1"
Case 3
MsgBox "Run the code for checkbox 2"
Case 5
MsgBox "Run the code for checkbox 3"
Case 4
MsgBox "Run the code for checkbox 1 + 2"
Case 9
MsgBox "Run the code for checkbox 1 + 2 + 3"
Case 6
MsgBox "Run the code for checkbox 1 + 3"
Case 8
MsgBox "Run the code for checkbox 2 + 3"
End Select
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message

...
Thanks Ron! One more curve....How can I add check boxes and allow user to select more than one check box which in

turn
previews
multiple print areas? In other words the user checks box 1 and box 2...hits the "OK" button and it previews both of

those
print
areas.
Thanks in advance












JORDON

Print Box
 
I think I just figured it out! Thanks so much for the help...I think I am done now!
Thanks again.

"Ron de Bruin" wrote:

I don't see your code

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Thanks! Below is the code I am using. It works when I select one check box...however when I choose 2 check boxes the "ok" button

does not do anything...can you assist? Basically what I would like to do is enable the user to select 2 boxes and have those print
areas show up as two pages in the print preview screen. The areas to print are on different pages.
Thanks

"Ron de Bruin" wrote:

Hi Jordon

Sorry again
No problem

Use this
Range("A1:A10,B1:B10").PrintPreview
or
Range("A1:A10,B1:B10,C1:C10").PrintPreview




--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Hi Ron,
Sorry again...this works, however..I need to have each checkbox choice show up together on the print preview instead of

having
to "close" the print preview to go to the next print area. In other words, the user selects box 1 & 2...the preview window has

the
option of clicking on "next" to go to the next choice. Can you help me write the code for this?
Thanks

"Ron de Bruin" wrote:

Hi Jordon

You must Unload the Userform first

like this

Case 1
Unload Me
Range("A1:A10").PrintPreview
Case 3
Unload Me
Range("B1:B10").PrintPreview
Case 5
Unload Me
Range("C1:C10").PrintPreview
Case 4
Unload Me
Range("A1:A10").PrintPreview
Range("B1:B10").PrintPreview


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Thanks again Ron! Great help! Sorry to keep on, but when I add the print preview code after say the first check box...it
works,
previews, but the userform stay on top and does not let me get out of it. Is there a way to close the userform after

confirming
selection? Thanks again in advance.

----- Ron de Bruin wrote: -----

Hi Jordon

Add three checkboxes on your userform and one button.
Try this code for the button

Private Sub CommandButton1_Click()
Dim Num As Integer
Num = Abs(CheckBox1.Value) * 1 + _
Abs(CheckBox2.Value) * 3 + _
Abs(CheckBox3.Value) * 5

Select Case Num
Case 1
MsgBox "Run the code for checkbox 1"
Case 3
MsgBox "Run the code for checkbox 2"
Case 5
MsgBox "Run the code for checkbox 3"
Case 4
MsgBox "Run the code for checkbox 1 + 2"
Case 9
MsgBox "Run the code for checkbox 1 + 2 + 3"
Case 6
MsgBox "Run the code for checkbox 1 + 3"
Case 8
MsgBox "Run the code for checkbox 2 + 3"
End Select
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message
...
Thanks Ron! One more curve....How can I add check boxes and allow user to select more than one check box which in
turn
previews
multiple print areas? In other words the user checks box 1 and box 2...hits the "OK" button and it previews both of
those
print
areas.
Thanks in advance













Ron de Bruin

Print Box
 
Hi Jordon

If you have problems post your code and I will
try to help you.

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
I think I just figured it out! Thanks so much for the help...I think I am done now!
Thanks again.

"Ron de Bruin" wrote:

I don't see your code

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Thanks! Below is the code I am using. It works when I select one check box...however when I choose 2 check boxes the "ok"

button
does not do anything...can you assist? Basically what I would like to do is enable the user to select 2 boxes and have those

print
areas show up as two pages in the print preview screen. The areas to print are on different pages.
Thanks

"Ron de Bruin" wrote:

Hi Jordon

Sorry again
No problem

Use this
Range("A1:A10,B1:B10").PrintPreview
or
Range("A1:A10,B1:B10,C1:C10").PrintPreview




--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message ...
Hi Ron,
Sorry again...this works, however..I need to have each checkbox choice show up together on the print preview instead of

having
to "close" the print preview to go to the next print area. In other words, the user selects box 1 & 2...the preview window

has
the
option of clicking on "next" to go to the next choice. Can you help me write the code for this?
Thanks

"Ron de Bruin" wrote:

Hi Jordon

You must Unload the Userform first

like this

Case 1
Unload Me
Range("A1:A10").PrintPreview
Case 3
Unload Me
Range("B1:B10").PrintPreview
Case 5
Unload Me
Range("C1:C10").PrintPreview
Case 4
Unload Me
Range("A1:A10").PrintPreview
Range("B1:B10").PrintPreview


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message

...
Thanks again Ron! Great help! Sorry to keep on, but when I add the print preview code after say the first check

box...it
works,
previews, but the userform stay on top and does not let me get out of it. Is there a way to close the userform after

confirming
selection? Thanks again in advance.

----- Ron de Bruin wrote: -----

Hi Jordon

Add three checkboxes on your userform and one button.
Try this code for the button

Private Sub CommandButton1_Click()
Dim Num As Integer
Num = Abs(CheckBox1.Value) * 1 + _
Abs(CheckBox2.Value) * 3 + _
Abs(CheckBox3.Value) * 5

Select Case Num
Case 1
MsgBox "Run the code for checkbox 1"
Case 3
MsgBox "Run the code for checkbox 2"
Case 5
MsgBox "Run the code for checkbox 3"
Case 4
MsgBox "Run the code for checkbox 1 + 2"
Case 9
MsgBox "Run the code for checkbox 1 + 2 + 3"
Case 6
MsgBox "Run the code for checkbox 1 + 3"
Case 8
MsgBox "Run the code for checkbox 2 + 3"
End Select
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jordon" wrote in message
...
Thanks Ron! One more curve....How can I add check boxes and allow user to select more than one check box

which in
turn
previews
multiple print areas? In other words the user checks box 1 and box 2...hits the "OK" button and it previews both

of
those
print
areas.
Thanks in advance
















All times are GMT +1. The time now is 03:33 PM.

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