Revised btnprint1_click()
Bruce,
I hope this doesn't sound harsh, it isn't meant to be.
Just straight forward.
Hope the below gets the crinkles out.
If not, post back...
steve
First
not SET Printthisrange = Range("OBACGG").select
but SET Printthisrange = Range("OBACGG")
remember when using Set
Set objectname = object
in your case object is a range
---------------------------------
Select Case Value
Case Value1
whatever you want
Case Value2
whatever you want
not
Select Case Selectprnrange
Case 1
Printoption = "Cantera Natural Gas"
Set Printthisrange = Range("OBACGG")
Case 2
Printoption = "DEFS"
Set Printthisrange = Range("OBADEFS")
Case 3
Printoption = "Agave"
Set Printthisrange = Range("OBAAgave")
Case 4
Printoption = "TWML"
Set Printthisrange = Range("OBATWML")
Case 5
Printoption = "Print All OBA Pages"
but
Select Case Printoption
Case "Cantera Natural Gas"
Set Printthisrange = Range("OBACGG")
Case "DEFS"
Set Printthisrange = Range("OBADEFS")
Case "Agave"
Set Printthisrange = Range("OBAAgave")
Case "TWML"
Set Printthisrange = Range("OBATWML")
Case "Print All OBA Pages"
Set Printthisrange = ?????? ' (i don't know what you need
here)
"Bruce Roberson" wrote in message
...
Steve:
I'm sorry if I appear to be dense today, but I think I
followed your last post. Maybe I missed part of your
instruction. However, the thing still stalls out at the
same point each time. I put in your change which was:
SET Printthisrange = Range("OBACGG").select
The stalling line again is:
Range("Printthisrange").Select
Here reposted below is the entire Sub as it appears at
this point.
With regards to your Case 5 suggestion, I can't Print all
4 ranges by printing the entire sheet because these 4
reports are all on separate sheets. So, is there a way to
select multiple ranges with the Set statement, something
like this?:
Set Printthisrange = Range("OBACGG"), Range("OBADEFS"),
Range("OBAAgave"), Range("OBATWML")
And then, would the line:
Selection.printpreview
work with all them at the same time?
__________________________________________________ _________
Private Sub btnprint1_Click()
Dim myOption As Control
Dim Printoption
Dim Printthisrange As Range
For Each myOption In Frame1.Controls
If myOption.Value = True Then
Printoption = myOption.Caption
End If
Next myOption
Select Case Selectprnrange
Case 1
Printoption = "Cantera Natural Gas"
Set Printthisrange = Range("OBACGG")
Case 2
Printoption = "DEFS"
Set Printthisrange = Range("OBADEFS")
Case 3
Printoption = "Agave"
Set Printthisrange = Range("OBAAgave")
Case 4
Printoption = "TWML"
Set Printthisrange = Range("OBATWML")
Case 5
Printoption = "Print All OBA Pages"
End Select
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PaperSize = xlPaperLegal
.FitToPagesWide = 1
.FitToPagesTall = 1
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Unload Me
Range("Printthisrange").Select
Selection.PrintPreview
Set Printthisrange = Nothing
Range("a1").Select
End Sub
|