LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Conditonal Formatting VB Code?

Ron,

Try This


Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo ws_exit
If Not Intersect(Target, Range("N7:N151")) Is Nothing Then
With Target
Select Case .Value
Case "Red"
.Interior.ColorIndex = 3
.Font.ColorIndex = 1
.Font.Bold = True
Case "Blue"
.Interior.ColorIndex = 5
.Font.ColorIndex = 2
.Font.Bold = True
Case "Green"
.Interior.ColorIndex = 4
.Font.ColorIndex = 1
.Font.Bold = True
Case "Amber"
.Interior.ColorIndex = 6
.Font.ColorIndex = 1
.Font.Bold = True
Case "Complete"
.Interior.ColorIndex = 1
.Font.ColorIndex = 2
.Font.Bold = True
End Select
End With
End If

ws_exit:
Application.EnableEvents = True

End Sub


End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"RonS" wrote in message
...
Tom

Is there a way to do this a single cell at a time using the change event,

for multiple columns?

similar to this:

Private Sub Worksheet_Change(ByVal Target As Range)

Dim oCell As Range

For Each oCell In Intersect(Columns("N"), ActiveSheet.UsedRange)
Select Case oCell.Value
Case "Red"
oCell.Interior.ColorIndex = 3
oCell.Font.ColorIndex = 1
oCell.Font.Bold = True
Case "Blue"
oCell.Interior.ColorIndex = 5
oCell.Font.ColorIndex = 2
oCell.Font.Bold = True
Case "Green"
oCell.Interior.ColorIndex = 4
oCell.Font.ColorIndex = 1
oCell.Font.Bold = True
Case "Amber"
oCell.Interior.ColorIndex = 6
oCell.Font.ColorIndex = 1
oCell.Font.Bold = True
Case "Complete"
oCell.Interior.ColorIndex = 1
oCell.Font.ColorIndex = 2
oCell.Font.Bold = True
End Select
Next oCell

End Sub





 
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
Conditonal formatting SunshineinFt.Myers[_2_] Excel Worksheet Functions 4 March 9th 09 05:23 PM
Conditonal Formatting TSK Excel Worksheet Functions 2 May 7th 08 10:33 AM
conditonal formatting in VB JBW Excel Worksheet Functions 2 October 12th 07 05:02 PM
Conditonal formatting Hawksby Excel Discussion (Misc queries) 2 March 9th 07 01:49 PM
Conditonal Formatting Matt Excel Discussion (Misc queries) 3 April 21st 06 07:42 PM


All times are GMT +1. The time now is 09:50 AM.

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"