ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   format row based on non-blank or blank cell (https://www.excelbanter.com/excel-programming/344238-format-row-based-non-blank-blank-cell.html)

mhoffmeier[_3_]

format row based on non-blank or blank cell
 
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


Nigel

format row based on non-blank or blank cell
 
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

--
Cheers
Nigel



"mhoffmeier" wrote in message
oups.com...
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





All times are GMT +1. The time now is 07:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com