J
JohnBlack
Dear all, I'm having a problem with a macro I wrote. I have an excel file
which needs to be filled out. I have used conditional formatting so that when
for example C4 gets filled out, Cell D4 gets a blue color. Becasue users keep
forgetting to fill out this blue colorded cell I want to prevent them from
saving it, until they fill it out.
But for some reason my code doesn't work at all. Saving is still possible
when leaving the cells blank
See code below
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If ActiveWorkbook.Range("D4").Interior.Color = RGB(0, 255, 255) And
ActiveWorkbook.Range("D4") = "" Then
MsgBox ("Please fill out the Blue highlighted cells.")
Cancel = True
ElseIf ActiveWorkbook.Range("D6").Interior.Color = RGB(0, 255, 255) And
ActiveWorkbook.Range("D6") = "" Then
MsgBox ("Please fill out the Blue highlighted cells.")
Cancel = True
End If
End Sub
Can anyone help me
which needs to be filled out. I have used conditional formatting so that when
for example C4 gets filled out, Cell D4 gets a blue color. Becasue users keep
forgetting to fill out this blue colorded cell I want to prevent them from
saving it, until they fill it out.
But for some reason my code doesn't work at all. Saving is still possible
when leaving the cells blank
See code below
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If ActiveWorkbook.Range("D4").Interior.Color = RGB(0, 255, 255) And
ActiveWorkbook.Range("D4") = "" Then
MsgBox ("Please fill out the Blue highlighted cells.")
Cancel = True
ElseIf ActiveWorkbook.Range("D6").Interior.Color = RGB(0, 255, 255) And
ActiveWorkbook.Range("D6") = "" Then
MsgBox ("Please fill out the Blue highlighted cells.")
Cancel = True
End If
End Sub
Can anyone help me