ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   change font color for row... (https://www.excelbanter.com/excel-programming/411865-change-font-color-row.html)

mark kubicki

change font color for row...
 
i have this line of code to change the font color of a row; however, nothing
changes... any suggestions?

Range(target.Row & ":" & target.Row).Font.ColorIndex = 3

thanks in advance,
mark



JLGWhiz

change font color for row...
 
If is was set by conditional formatting then you will need:

Range(target.Row & ":" & target.Row).FormatConditions(1).Font.ColorIndex = 3


"Mark Kubicki" wrote:

i have this line of code to change the font color of a row; however, nothing
changes... any suggestions?


thanks in advance,
mark




mark kubicki

change font color for row...
 
nope...
there is 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 (only) of the cells n the row has a "conditoinal formatting"


"JLGWhiz" wrote in message
...
If is was set by conditional formatting then you will need:

Range(target.Row & ":" & target.Row).FormatConditions(1).Font.ColorIndex =
3


"Mark Kubicki" wrote:

i have this line of code to change the font color of a row; however,
nothing
changes... any suggestions?


thanks in advance,
mark






JLGWhiz

change font color for row...
 
Sorry to take so long getting back. I set up your code on my system and it
worked as intended. I can only suggest that you step through the code line
by line to see if it performs as you intended with the data in your workbook.
In case you don't know how to do that, just right click on the sheet that
contains the code, then click View Code. On the second line of the
Worksheet_Change macro, click on the left frame of the code window to set a
breakpoint. You should see a dark dot on the frame and a dark line across
the code line. Then click your workbook icon at the bottom of the screen to
bring the worksheet into focus. Make a change in the target range and press
enter or click another cell. This should return you to the VB editor where
you can use the F8 key to step through the rest of the code.

Good luck.

"Mark Kubicki" wrote:

nope...
there is 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 (only) of the cells n the row has a "conditoinal formatting"


"JLGWhiz" wrote in message
...
If is was set by conditional formatting then you will need:

Range(target.Row & ":" & target.Row).FormatConditions(1).Font.ColorIndex =
3


"Mark Kubicki" wrote:

i have this line of code to change the font color of a row; however,
nothing
changes... any suggestions?


thanks in advance,
mark








All times are GMT +1. The time now is 07:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com