I tried to call button but it did not work. I think the if true then else code is causing the issue. Below is code.
Private Sub ToggleButton3_Click()
'Sub PrintToEnd()
'Convert this over to an active X toggle to change print ranges between final color (V to AP) and working version (A to R)
'Worksheets("report1").Activate
If ToggleButton3.Value = True Then
ToggleButton3.Caption = "CLICK To Go To Working Mode"
Dim Z As Range, Zw As Long
With ActiveSheet
Zw = .Range("AQ:AQ").Find("RangeEnd").Row
Set Z = .Range("V1:AP" & Zw)
.PageSetup.PrintArea = Z.Address
With ActiveSheet.PageSetup
'.PrintTitleRows = ""
'.PrintTitleColumns = ""
.LeftMargin = Application.InchesToPoints(0.2)
.RightMargin = Application.InchesToPoints(0.2)
.TopMargin = Application.InchesToPoints(0.2)
.BottomMargin = Application.InchesToPoints(0.4)
.HeaderMargin = Application.InchesToPoints(0.2)
.FooterMargin = Application.InchesToPoints(0.2)
.PaperSize = xlPaperLegal
'.PaperSize = xlPaperA4
'.Orientation = xlPortrait 'xlLandscape
.Zoom = False
'.FitToPagesWide = 1
'.FitToPagesTall = 1
End With
ActiveWindow.DisplayGridlines = False
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True 'Print Preview
'ActiveWindow.SelectedSheets.PrintOut Copies:=1 'Printout
End With
'Add code to print if desired
'copied from toggle1 private macro
Dim rng As Range
Set rng = ActiveSheet.Range("A3:R307")
FilterField = WorksheetFunction.Match("Detail", rng.Rows(1), 0)
rng.AutoFilter Field:=FilterField, Criteria1:=Array( _
"1"), Operator:=xlFilterValues
'used to remove revenue top few rows
Rows("4:68").EntireRow.Hidden = True
'used to move cursor to final area
ActiveSheet.Range("ae1").Select
Else
ToggleButton3.Caption = "Click To Go To Final Mode"
Dim Y As Range, Yw As Long
With ActiveSheet
Yw = .Range("S:S").Find("RangeEnd").Row
Set Y = .Range("A1:R" & Yw)
.PageSetup.PrintArea = Y.Address
With ActiveSheet.PageSetup
'.PrintTitleRows = ""
'.PrintTitleColumns = ""
.LeftMargin = Application.InchesToPoints(0.2)
.RightMargin = Application.InchesToPoints(0.2)
.TopMargin = Application.InchesToPoints(0.2)
.BottomMargin = Application.InchesToPoints(0.4)
.HeaderMargin = Application.InchesToPoints(0.2)
.FooterMargin = Application.InchesToPoints(0.2)
.PaperSize = xlPaperLetter
'.PaperSize = xlPaperA4
'.Orientation = xlPortrait 'xlLandscape
.Zoom = False
'.FitToPagesWide = 1
'.FitToPagesTall = 1
End With
ActiveWindow.DisplayGridlines = False
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True 'Print Preview
'ActiveWindow.SelectedSheets.PrintOut Copies:=1 'Printout
End With
'copied from toggle1 private macro
Dim rngb As Range
Set rngb = ActiveSheet.Range("A3:R307")
FilterField = WorksheetFunction.Match("Detail", rngb.Rows(1), 0)
rngb.AutoFilter Field:=FilterField, Criteria1:=Array( _
"1"), Operator:=xlFilterValues
'copied from gotcell macro
ActiveSheet.Range("a1").Select
End If
End Sub
Private Sub ToggleButton4_Click()
Call ToggleButton3
End Sub