This code works if I use the sheet name, how can I use the vba sheet name, sheet5, for this
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "SheetToPrint" Then
'how can I use something like this
If ActiveSheet = sheet5 Then
Cancel = True
MsgBox "Use the button on the page to print"
End If
End Sub
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "SheetToPrint" Then
'how can I use something like this
If ActiveSheet = sheet5 Then
Cancel = True
MsgBox "Use the button on the page to print"
End If
End Sub