I need to stop users from saving the file if in column A they select YES from a dropdown box and don’t enter anything in Column B.
The dropdown has blank, YES and NO.
I have the following macro that checks for blank cells in column B but how can I change it to check for a YES in column A and blank in column B.
If NO or blank is in column A column B can be blank.
I use
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim myRange As Range
Set myRange = worksheets(“CentralWest”).Range(“B2:B1532”)
If Application.WorksheetFunction.CountA(myRange) <_
MyRange.cells.Count Then
MsgBox “Please fill in the Comments Section”
Cancel = True
End If
END SUB
Is there a way I can change the macro to check for a “YES” in column A and column B is blank.
If Column A is blank or “NO” column B does not require to be filled in.
Any help appreciated
Cheers
Dean
Bookmarks