format row based on non-blank or blank cell

M

mhoffmeier

Hello,
I use excel for construction estimates. It would be a nice if a line
item would be black if either the quantity was filled in, or the notes
field was filled out explaining why it was not. I'd like the other
line items to be grey, but not deleted. what might a program look like
that made a row grey if either column e or n were blank?
Thanks
 
N

Nigel

Put this code in the worksheet you wish to act on, when the worksheet
changes the current row is tested

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 5 Or Target.Column = 14 Then
If Val(Cells(Target.Row, 5)) = 0 And Trim(Cells(Target.Row, 14)) = ""
Then
Rows(Target.Row).Font.ColorIndex = 15
Else
Rows(Target.Row).Font.ColorIndex = 0
End If
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top