LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default VBA code to update row format

On Jun 2, 8:53*am, Mark Kubicki
wrote:
I have some VBA code to change the font color of a row; however,
nothing *changes... * any suggestions?

It starts with a "change event" that triggers the function:

* * * * * * Private Sub Worksheet_Change(ByVal target As Range)
* * * * * * * * Application.Run UpdateRowColor(target)

then the function runs like this:

* * * * * * Function UpdateRowColor(target)
* * * * * * 'This section effects changes to the "Project Phase" column
* * * * * * If Not Intersect(target, Range("A:A")) Is Nothing Then
* * * * * * * * If target.Count 1 Then
* * * * * * * * * * Exit Function
* * * * * * * * Else
* * * * * * * * * * Select Case target.Value
* * * * * * * * * * Case Is = "CA"
* * * * * * * * * * * * Range(target.Row & ":" & target.Row).Font.ColorIndex
= 45
* * * * * * * * * * Case Is = "CD"
* * * * * * * * * * * * *...

(one (but only 1) of the cells in any given row has a "conditoinal
formatting")

*thanks in advance,
*mark


This works fine for me.

In the sheet that you want this to take place in:
Private Sub Worksheet_Change(ByVal target As Range)
Application.Run UpdateRowColor(target)
End Sub

In a standard module:
Function UpdateRowColor(target As Range)
'This section effects changes to the "Project Phase" column
If Not Intersect(target, Range("A:A")) Is Nothing Then
If target.Count 1 Then
Exit Function
Else
With target
Select Case .Value
Case Is = "CA"
Rows(.Row).Font.ColorIndex = 45
Case Is = "CD"
Rows(.Row).Font.ColorIndex = 5
End Select
End With
End If
End If
End Function
 
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
update code Lost Excel Discussion (Misc queries) 0 January 16th 09 04:53 AM
Code to conditional format all black after date specified in code? wx4usa Excel Discussion (Misc queries) 3 December 26th 08 07:06 PM
vba code...... on update........... CRANSWICK, P[_2_] Excel Programming 3 August 6th 07 05:38 PM
How can I update VBA code in a module that is running my VBA code? Gummy Excel Programming 3 June 12th 07 06:26 PM
code to update a macro Paul Excel Programming 1 June 16th 04 02:59 AM


All times are GMT +1. The time now is 09:37 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"