Hi,
I am very close to having a macro good to go for printing off certain worksheets, with the exception of having troubleshooted the cancel and exit button on the inputbox when asking for the number of copies. Could you please help me on this?
Code is below:
After NumCopies line I have added
If NumCopies = "" Then Exit Sub
but still receive the error message "Run time error 13, type mismatch"
I need this asap any help will be much appreciated!
Thanks,
James
I am very close to having a macro good to go for printing off certain worksheets, with the exception of having troubleshooted the cancel and exit button on the inputbox when asking for the number of copies. Could you please help me on this?
Code is below:
Code:
Sub Printing()
Dim NumCopies As Long
Dim ans As String
NumCopies = InputBox("Please enter number of copies", "Print Staff Lists")
ans = MsgBox("Are you sure you want to print " & NumCopies & "?", vbQuestion + vbYesNo, "Print pages")
If ans = vbNo Then
Exit Sub
Else
Worksheets("1").PrintOut Copies:=NumCopies
Worksheets("2").PrintOut Copies:=NumCopies
Worksheets("3").PrintOut Copies:=NumCopies
Worksheets("4").PrintOut Copies:=NumCopies
Worksheets("5").PrintOut Copies:=NumCopies
End If
End Sub
After NumCopies line I have added
If NumCopies = "" Then Exit Sub
but still receive the error message "Run time error 13, type mismatch"
I need this asap any help will be much appreciated!
Thanks,
James