Changing color of a row when typed in...

Closed
bwhite06 Posts 3 Registration date Monday August 27, 2012 Status Member Last seen August 28, 2012 - Aug 27, 2012 at 09:42 PM
bwhite06 Posts 3 Registration date Monday August 27, 2012 Status Member Last seen August 28, 2012 - Aug 28, 2012 at 08:35 PM
Hello,

I'm making an excel spreadsheet. What I'm wanting to do is have a row turn red if I type something in the first cell.

For example: If I type something in A2, I want cells A2:R2 to turn red.

I've tried to search through some other questions, but cannot find my way through this. I don't know if I need to do an IF formula or Conditional Formatting. Please help!

2 replies

venkat1926 Posts 1864 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 810
Aug 28, 2012 at 12:35 AM
you need an EVENT HANDLER

RIGHT CLICK THE TAB OF THE PARTICULAR SHEET
CLICK VIEW CODE

in the window that opens copy this event code

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 1 Then Exit Sub
Application.EnableEvents = False
Range(Target, Cells(Target.Row, "R")).Interior.ColorIndex = 3
Application.EnableEvents = True
End Sub


save the file

NOW GO TO THE SHEET SOMETHING IN ANY CELL IN COLUMN A
1
bwhite06 Posts 3 Registration date Monday August 27, 2012 Status Member Last seen August 28, 2012
Aug 28, 2012 at 08:35 PM
That worked great! The row turns red once I type in it. But if I delete what I typed to turn the row red, the row remains red. Is there any way to make it "un-highlight" the row once something is deleted from the cells in column A?
0
bwhite06 Posts 3 Registration date Monday August 27, 2012 Status Member Last seen August 28, 2012
Aug 28, 2012 at 08:09 PM
That worked great! The row turns red once I type in it. But if I delete what I typed to turn the row red, the row remains red.

Is there any way to make it "un-highlight" the row once something is deleted from the cells in column A?
0