Hi,
I have a worksheet that is set up to 8 print areas I think I have made a macro that should only print each page if the first cell in it has contents but I cant seem to get it to work, would you be so kind as to have a look please, apologies if it's wrong I'm pretty new to VBA.
Thanks for the help
I have a worksheet that is set up to 8 print areas I think I have made a macro that should only print each page if the first cell in it has contents but I cant seem to get it to work, would you be so kind as to have a look please, apologies if it's wrong I'm pretty new to VBA.
Code:
Sub Printing()
'
' Printing Macro
'
If IsEmpty(Range("b2").Value) = True Then
Cancel = True
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1
End If
If IsEmpty(Range("b52").Value) = True Then
Cancel = True
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=2, Copies:=1
End If
If IsEmpty(Range("b102").Value) = True Then
Cancel = True
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=3, Copies:=1
End If
If IsEmpty(Range("b152").Value) = True Then
Cancel = True
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=4, Copies:=1
End If
If IsEmpty(Range("b202").Value) = True Then
Cancel = True
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=5, Copies:=1
End If
If IsEmpty(Range("b252").Value) = True Then
Cancel = True
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=6, Copies:=1
End If
If IsEmpty(Range("b302").Value) = True Then
Cancel = True
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=7, Copies:=1
End If
If IsEmpty(Range("b352").Value) = True Then
Cancel = True
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=8, Copies:=1
End If
End Sub
Thanks for the help