I have a users form that contains a print macro. Included in the macro is a message box that allow the user to input the no. of copies to print. However after selecting the number of copies to print and selecting the OK button, the message box pops up again
Please amend my macro to prevent this from popping up once printed unless the button on the user form is selected again
Please amend my macro to prevent this from popping up once printed unless the button on the user form is selected again
Code:
Private Sub OKButton_Click()
Dim iNum As Variant
Application.ScreenUpdating = False
If OptionBr1 Then
Sheets(1).Select
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintGridlines = True
.PrintArea = "Branch1TAX"
.PrintTitleRows = "$16:$16"
.PrintTitleColumns = "$B:$D"
.LeftHeader = "&D&T"
.CenterHeader = ""
.Orientation = xlLandscape
End With
End If
Application.PrintCommunication = True
iNum = InputBox(Prompt:="Please enter number of copies to print.", _
Title:="Number of Copies", _
Default:=1)
Select Case iNum
Case 0, ""
MsgBox ("Printing aborted.")
Case Else
ActiveWindow.SelectedSheets.PrintOut Copies:=iNum, Collate:=True
End Select
If OptionBr2 Then
Sheets(1).Select
Range("F:T").EntireColumn.Hidden = True
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintGridlines = True
.PrintArea = "Branch2Tax"
.PrintTitleRows = "$16:$16"
.PrintTitleColumns = "$B:$D"
.LeftHeader = "&D&T"
.CenterHeader = ""
.Orientation = xlLandscape
End With
End If
Application.PrintCommunication = True
iNum = InputBox(Prompt:="Please enter number of copies to print.", _
Title:="Number of Copies", _
Default:=1)
Select Case iNum
Case 0, ""
MsgBox ("Printing aborted.")
Case Else
ActiveWindow.SelectedSheets.PrintOut Copies:=iNum, Collate:=True
Range("F:T").EntireColumn.Hidden = False
Columns("E:CX").EntireColumn.AutoFit
End Select
End Sub