Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default setting print ranges to print based on option

Hi all,
I have a function that has radio boxes as a parameter selection. At
each radio box I have a macro assigned which looks similar to below
where I assign an upper row and a lower row for a range that I wish
to
print. The variable was defined as Global and as a String.

Sub RadioButtonSelection_1Example()
vrow1 = 98 'both vrow1 and vrow2 defined as global and long
vrow2 = 109
End Sub


Sub printme()
vrow1 = "A" & vrow1 'the final product will be A98 in this case
vrow2 = "A" & vrow2 'the final product will be A109 in this case
If e_agency = True Then
Range("A86:A97", "&vrow1:&vrow2").Select
Selection.PrintOut Copies:=1, Collate:=True
Else
Range("&vrow1:&vrow2").Select
Selection.PrintOut Copies:=1, Collate:=True
End If
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default setting print ranges to print based on option

On May 1, 3:56 pm, bluegrassstateworker
wrote:
Hi all,
I have a function that has radio boxes as a parameter selection. At
each radio box I have a macro assigned which looks similar to below
where I assign an upper row and a lower row for a range that I wish
to
print. The variable was defined as Global and as a String.

Sub RadioButtonSelection_1Example()
vrow1 = 98 'both vrow1 and vrow2 defined as global and long
vrow2 = 109
End Sub

Sub printme()
vrow1 = "A" & vrow1 'the final product will be A98 in this case
vrow2 = "A" & vrow2 'the final product will be A109 in this case
If e_agency = True Then
Range("A86:A97", "&vrow1:&vrow2").Select
Selection.PrintOut Copies:=1, Collate:=True
Else
Range("&vrow1:&vrow2").Select
Selection.PrintOut Copies:=1, Collate:=True
End If
End Sub


I forgot to add that the ranges are on different worksheet (if that
makes any difference)

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default setting print ranges to print based on option

Did you state your problem?

On May 2, 9:03 am, bluegrassstateworker
wrote:
On May 1, 3:56 pm, bluegrassstateworker
wrote:





Hi all,
I have a function that has radio boxes as a parameter selection. At
each radio box I have a macro assigned which looks similar to below
where I assign an upper row and a lower row for a range that I wish
to
print. The variable was defined as Global and as a String.


Sub RadioButtonSelection_1Example()
vrow1 = 98 'both vrow1 and vrow2 defined as global and long
vrow2 = 109
End Sub


Sub printme()
vrow1 = "A" & vrow1 'the final product will be A98 in this case
vrow2 = "A" & vrow2 'the final product will be A109 in this case
If e_agency = True Then
Range("A86:A97", "&vrow1:&vrow2").Select
Selection.PrintOut Copies:=1, Collate:=True
Else
Range("&vrow1:&vrow2").Select
Selection.PrintOut Copies:=1, Collate:=True
End If
End Sub


I forgot to add that the ranges are on different worksheet (if that
makes any difference)- Hide quoted text -

- Show quoted text -


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default setting print ranges to print based on option

On May 3, 4:09 pm, Carl Hartness wrote:
Did you state your problem?

On May 2, 9:03 am, bluegrassstateworker
wrote:



On May 1, 3:56 pm, bluegrassstateworker
wrote:


Hi all,
I have a function that has radio boxes as a parameter selection. At
each radio box I have a macro assigned which looks similar to below
where I assign an upper row and a lower row for a range that I wish
to
print. The variable was defined as Global and as a String.


Sub RadioButtonSelection_1Example()
vrow1 = 98 'both vrow1 and vrow2 defined as global and long
vrow2 = 109
End Sub


Sub printme()
vrow1 = "A" & vrow1 'the final product will be A98 in this case
vrow2 = "A" & vrow2 'the final product will be A109 in this case
If e_agency = True Then
Range("A86:A97", "&vrow1:&vrow2").Select
Selection.PrintOut Copies:=1, Collate:=True
Else
Range("&vrow1:&vrow2").Select
Selection.PrintOut Copies:=1, Collate:=True
End If
End Sub


I forgot to add that the ranges are on different worksheet (if that
makes any difference)- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


I am using Excel in this case as an electronic form. My problem is
that the above syntax is not working and I am unsure of the best way
to pass a radio box selection as a print range parameter; something in
the syntax (or logic) is wrong. Here is what I would like to do: If a
radio box is checked (A checkbox would work too) then I want to have a
range printed out. If there are multiple groups checked then I want
to include them in a single printout. In this case, I have a
worksheet containing the radio buttons and the user navigates
throughout various worksheets within the workbook. When finished, a
macro runs the printing of each section and a set of instructions
based on the selections made when the workbook was opened. I havent
seen any VBA examples to draw from for guidance.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default setting print ranges to print based on option

Debug.Print Range("&vrow1:&vrow2").Address gives an error.
Without prepending "A" to vrows, use
Debug.Print Range(Cells(vrow1, 1), Cells(vrow2, 1)).Address

The multiple range is trickier. The key is to use a string to create
the compound address:
Debug.Print Range("A86:A97", "&vrow1:&vrow2").Address gives an error.
s$ = "A86:A97," & Range(Cells(vrow1, 1), Cells(vrow2, 1)).Address
Debug.Print Range(s$).Address

Hope this helps
Carl.

On May 4, 8:00 am, bluegrassstateworker
wrote:
On May 3, 4:09 pm, Carl Hartness wrote:





Did you state your problem?


On May 2, 9:03 am, bluegrassstateworker
wrote:


On May 1, 3:56 pm, bluegrassstateworker
wrote:


Hi all,
I have a function that has radio boxes as a parameter selection. At
each radio box I have a macro assigned which looks similar to below
where I assign an upper row and a lower row for a range that I wish
to
print. The variable was defined as Global and as a String.


Sub RadioButtonSelection_1Example()
vrow1 = 98 'both vrow1 and vrow2 defined as global and long
vrow2 = 109
End Sub


Sub printme()
vrow1 = "A" & vrow1 'the final product will be A98 in this case
vrow2 = "A" & vrow2 'the final product will be A109 in this case
If e_agency = True Then
Range("A86:A97", "&vrow1:&vrow2").Select
Selection.PrintOut Copies:=1, Collate:=True
Else
Range("&vrow1:&vrow2").Select
Selection.PrintOut Copies:=1, Collate:=True
End If
End Sub


I forgot to add that the ranges are on different worksheet (if that
makes any difference)- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


I am using Excel in this case as an electronic form. My problem is
that the above syntax is not working and I am unsure of the best way
to pass a radio box selection as a print range parameter; something in
the syntax (or logic) is wrong. Here is what I would like to do: If a
radio box is checked (A checkbox would work too) then I want to have a
range printed out. If there are multiple groups checked then I want
to include them in a single printout. In this case, I have a
worksheet containing the radio buttons and the user navigates
throughout various worksheets within the workbook. When finished, a
macro runs the printing of each section and a set of instructions
based on the selections made when the workbook was opened. I havent
seen any VBA examples to draw from for guidance.- Hide quoted text -

- Show quoted text -




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print Ranges based on conditions Courtney Excel Discussion (Misc queries) 0 July 16th 08 06:04 PM
Setting the print area in page set up to print 1 page wide by 2 pages tall EA[_2_] Excel Discussion (Misc queries) 2 July 12th 07 08:39 PM
Setting multiple ranges to print bluegrassstateworker Excel Discussion (Misc queries) 0 May 1st 07 08:21 PM
Print Area ranges print on separate pages? Lyndon Excel Discussion (Misc queries) 1 December 29th 06 05:22 PM
Print ranges based on cell value John Excel Programming 1 August 22nd 06 03:41 AM


All times are GMT +1. The time now is 10:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"