changing font color in named range using vba

P

punking315

I recieve a runtime error..." method 'color' of object 'font' failed "


this is the code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim black As Long
Dim white As Long
black = vbBlack
white = vbWhite

If Cells(5, 2).Text = "gable" Then
Range("saltboxroofing").Font.Color = white
Else
If Cells(5, 2).Text = "saltbox" Then
Range("saltboxroofing").Font.Color = black
Else
End If
End If
End Sub

any help is appreciated
 
P

punking315

thank you for the help. I must have some other underlying problem. it still
kicked the same error but referencing 'colorindex'.
 
D

Don Guillett

Although I would have written it very differently, I tested in xl2003 sheet
module and it worked, as written.
 

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