View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
merjet merjet is offline
external usenet poster
 
Posts: 812
Default Highlighting cells when errors occur

Column M is mandatory is Column L = "Yes"

How do I build this in? I also need the error message that was in my
original code to be kept to, so can I do both of these in the same code?


I don't imagine you mean entire columns, so I will assume only one
row. Add the following.

If Range("L1") = "Yes" And IsEmpty(Range("M1")) Then
c.Interior.ColorIndex = 3
Else
c.Interior.ColorIndex = 0
End If

If Range("L1") = "Yes" And IsEmpty(Range("M1")) _
Then Cancel = True

Simply substitute your MsgBox text for mine.

Merjet