Hello
The code is setup to validate if some of the columns are left blank. The code only fires if col 'C' is populated. Otherwise it doesn't validate on the last line. I'm trying to update it so either col 'C' or 'D' has to be populated before the code fires. Appreciate any help.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
LstRow = Sheets(1).Range("C65536").End(xlUp).Row
Dim FoundRange As Range
On Error GoTo X:
Set FoundRange = Sheets(1).Range("F8:H" & LstRow & ",J8:O" & LstRow).SpecialCells(xlCellTypeBlanks)
FoundRange.Select
Cancel = True
MsgBox "In order to SAVE & EXIT, please populate the mandatory columns ('F' thru 'H' and 'J' thru 'O')."
Exit Sub
X:
Cancel = False
End Sub
Bookmarks