Hi All, despite much searching and trials I almost have what I need but cannot work out the last bit.
I have 7 sheets as part of a training course session for each day of the week and two other sheets that have various stats on them drawn from the formula on the Monday to Friday sheets.
The following code works well:
It prints no problems if any sheet has a “Yes”, but what I need is to have a message box if there is a “No” in cell M1 on all sheets, in other words there has been no data input to anysheet. The “Yes” / “No” value works from a simple Countif formula on each sheet.
The message box would simply say “No data input to any sheet – Please enter data to print” and take me back to Sheet 1, A2
I have tried adding another loop to look for all “No”’ and inputting a message box in various places in the code but can’t work it out.
The ideal solution is 1: to loop through all the sheets and if there is a “Yes” on any sheet then print them but collate into one print job not individually and 2: if there is nothing to print (a “No” on every sheet) a message box showing as above.
Can anyoneassist?
UsingWin10 Excel 2016
I have 7 sheets as part of a training course session for each day of the week and two other sheets that have various stats on them drawn from the formula on the Monday to Friday sheets.
The following code works well:
Code:
[COLOR=black]Sub print_sessions()
Application.ScreenUpdating =False
Dim ws As Worksheet
For Each ws In Worksheets
Range("m1").Select
If [M1].Value = "Yes" Then
ws.Printout
End If
Next
Application.ScreenUpdating = True
End Sub[/COLOR]
The message box would simply say “No data input to any sheet – Please enter data to print” and take me back to Sheet 1, A2
I have tried adding another loop to look for all “No”’ and inputting a message box in various places in the code but can’t work it out.
The ideal solution is 1: to loop through all the sheets and if there is a “Yes” on any sheet then print them but collate into one print job not individually and 2: if there is nothing to print (a “No” on every sheet) a message box showing as above.
Can anyoneassist?
UsingWin10 Excel 2016