Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default changing font color in named range using vba

Try this

Private Sub Worksheet_Change(ByVal Target As Range)
If Cells(5, 2).Text = "gable" Then
Range("saltboxroofing").Font.ColorIndex = 2
Else
If Cells(5, 2).Text = "saltbox" Then
Range("saltboxroofing").Font.ColorIndex = 1
Else
End If
End If
End Sub


Mike

"punking315" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Font color changing by itself EJamison Excel Discussion (Misc queries) 2 September 18th 08 05:34 PM
Changing Font color based on font type or size John Excel Discussion (Misc queries) 2 February 7th 08 12:50 AM
Changing Font Color bagoxc Excel Discussion (Misc queries) 2 July 17th 06 01:14 AM
Changing the font color using VBA magoobee Excel Programming 1 June 4th 05 03:51 PM
Changing Font Color Brad E Excel Programming 3 April 7th 04 02:12 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"