bademployee
Board Regular
- Joined
- Aug 19, 2010
- Messages
- 184
Hi all,
Appreciate any help to make below work:
Currently, whatever option button is selected, the whole range(A1:Z183) is printing.
Thanks in advance
Mark
Appreciate any help to make below work:
Code:
Private Sub CommandButton1_Click()
Dim wks As Worksheet
Set wks = Worksheets("FQF")
With wks
Select Case Frame1.ActiveControl.Name
Case OptionButton1 'This is the name of the optionbutton
.PageSetup.PrintArea = "$A$1:$Z$55"
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.5)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
.PaperSize = xlPaperA4
.Orientation = xlLandscape
.Zoom = 65
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True 'Print Preview
'ActiveWindow.SelectedSheets.PrintOut Copies:=1 'Printout
Case OptionButton2
.PageSetup.PrintArea = "$A$1:$Z$183"
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.5)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
.PaperSize = xlPaperA4
.Orientation = xlLandscape
.Zoom = 65
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True 'Print Preview
'ActiveWindow.SelectedSheets.PrintOut Copies:=1 'Printout
End Select
End With
End Sub
Currently, whatever option button is selected, the whole range(A1:Z183) is printing.
Thanks in advance
Mark