View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
steve steve is offline
external usenet poster
 
Posts: 576
Default Revised btnprint1_click()

Bruce,

Almost forgot.

Since Printthisrange is declared as a range you can use
Printthisrange.Select

steve

"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