Highlighting cells when errors occur
In module for sheet with required input:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
For Each c In Range("A1:A3")
If IsEmpty(c) Then
c.Interior.ColorIndex = 3
Else
c.Interior.ColorIndex = 0
End If
Next c
End Sub
In ThisWorkbook module:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim c As Range
For Each c In Range("A1:A3")
If IsEmpty(c) Then Cancel = True
Next c
If Cancel = True Then MsgBox "File can't be saved if blah-blah cells
are empty."
End Sub
Change cell references to suit.
Hth,
Merjet
|