Overwrite conditional formatting

G

Gordon

Hi...

I want a user to place a 'Y' in a cell that will turn the font of the entire
active row grey font on a white background regardless of any conditional
formatting in place. I'm struggling - any help appreciated.
 
G

Gary''s Student

Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("A1")
Set r2 = Range("A1:IV1")
If Intersect(Target, r) Is Nothing Then Exit Sub
If r.Value <> "Y" Then Exit Sub
Application.EnableEvents = False
r2.ClearFormats
r2.Interior.ColorIndex = xlNone
r2.Font.ColorIndex = 48
Application.EnableEvents = True
End Sub

This is worksheet event code it looks at cell A1.
 
G

Gordon

Thanks for this. What I need is for any cell to accpet the Y to work on any
active row?
 
G

Gary''s Student

Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Target
Set r2 = Target.EntireRow
If r.Value <> "Y" Then Exit Sub
Application.EnableEvents = False
r2.ClearFormats
r2.Interior.ColorIndex = xlNone
r2.Font.ColorIndex = 48
Application.EnableEvents = True
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