MrExcel Publishing
Your One Stop for Excel Tips & Solutions

USERFORM PRINT BUTTON


Posted by STEVE on March 21, 2001 4:25 PM

Can someone help me figuire this out. I made a user form that pops up when you select the print button. On the form you select the checkboxes for each page you want to print(all pages are on the same sheet) I then use the code below to transfer the range for each page, to the sheet. I then concatenate all the ranges together to get one combined range.
what I need is to be able to press the CommandButton labeled print on the user form and have it print the concatenated range( this is located in cell "I102" on sheet4 and may look something like this) "A1:Y35,BV2:CY35"

thanks steve

Private Sub CheckBox2_Click()

If CheckBox2.Value = True Then
With Sheet4
Range("I100") = "A1:Y35"
End With
Else
With Sheet4
Range("I100") = ""
End With
End If
End Sub

Private Sub CheckBox3_Click()
If CheckBox3.Value = True Then
With Sheet4
Range("K100") = "AQ1:BN35"
End With
Else
With Sheet4
Range("K100") = ""
End With
End If
End Sub

Private Sub CheckBox4_Click()
If CheckBox4.Value = True Then
With Sheet4
Range("M100") = "BV1:CY35"
End With
Else
With Sheet4
Range("M100") = ""
End With
End If
End Sub

Private Sub CheckBox5_Click()
If CheckBox5.Value = True Then
With Sheet4
Range("O100") = "DD1:EA35"
End With
Else
With Sheet4
Range("O100") = ""
End With
End If
End Sub

Private Sub CheckBox6_Click()
If CheckBox6.Value = True Then
With Sheet4
Range("Q100") = "EE1:FA35"
End With
Else
With Sheet4
Range("Q100") = ""
End With
End If
End Sub


Posted by David Hawley on March 21, 2001 6:22 PM

Steve, in your code that concatenates you ranges place a line that names the range:

Range("I100").Name="PrintRange"


Then in your CommandButton put:

Range("PrintRange").PrintOut


Dave
OzGrid Business Applications

Posted by steve on March 22, 2001 6:40 AM