Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel Macro to change row and font color based on column value

I have a worksheet which I need to change the font color and row color
for a portion of the cells in a row. For example I have data in the
first five columns of a row, the sixth column is the column which
influences the change (data is text), then I have data in columns seven
though ten which will need to be changed based on column six, finally
there is columns eleven through fourteen which are not effected by the
change. I have been able to get the entire row to change but I can not
get only the portions I want to change. Also column six is a list so
initially it is blank but when I select a value that is when the change
takes place. Thanks for your help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Excel Macro to change row and font color based on column value

Maybe

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 6 And Target.Count = 1 Then
If Target.Value = "Criteria for change" Then
With Range(Cells(Target.Row, 7), Cells(Target.Row, 10))
.Font.ColorIndex = 2
.Interior.ColorIndex = 15
End With
End If
End If
End Sub

This is worksheet event code. Right click the sheet tab, select View Code
and paste the code in there.

Hope this helps
Rowan

"MT" wrote:

I have a worksheet which I need to change the font color and row color
for a portion of the cells in a row. For example I have data in the
first five columns of a row, the sixth column is the column which
influences the change (data is text), then I have data in columns seven
though ten which will need to be changed based on column six, finally
there is columns eleven through fourteen which are not effected by the
change. I have been able to get the entire row to change but I can not
get only the portions I want to change. Also column six is a list so
initially it is blank but when I select a value that is when the change
takes place. Thanks for your help.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Excel Macro to change row and font color based on column value

place this in the worksheet change event (thisworkbook module)
this will test a change


Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Excel.Range)

if target.column= 10 then

If Target = "1" Then
For i = 1 To 3
Cells(Target.Row, Target.Column).Offset(0,
i).Interior.ColorIndex = 14
Next i
End If

If Target = "" Then
For i = 1 To 3
Cells(Target.Row, Target.Column).Offset(0,
i).Interior.ColorIndex = xlNone
Next i
End If

end if

End Sub

hth
steve


On 31 Aug 2005 21:22:41 -0700, "MT" wrote:

I have a worksheet which I need to change the font color and row color
for a portion of the cells in a row. For example I have data in the
first five columns of a row, the sixth column is the column which
influences the change (data is text), then I have data in columns seven
though ten which will need to be changed based on column six, finally
there is columns eleven through fourteen which are not effected by the
change. I have been able to get the entire row to change but I can not
get only the portions I want to change. Also column six is a list so
initially it is blank but when I select a value that is when the change
takes place. Thanks for your help.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel Macro to change row and font color based on column value

Thanks I will give this a try

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel Macro to change row and font color based on column value

Thanks I will try both and let you guys know.

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
change font color based on a value Golf Nut[_2_] Excel Worksheet Functions 1 April 26th 07 03:30 PM
how do i change row font color based on cell value in that row brianatkraft Excel Worksheet Functions 5 November 2nd 06 08:53 PM
How do you change font color based on the value input? 1 = . mojeta Excel Discussion (Misc queries) 1 July 15th 05 07:17 PM
Excel - Hide Column/s or Change Font color Only for printing chris100 Excel Discussion (Misc queries) 6 July 13th 05 04:02 PM
Change Font Color Based on Classification sip8316 Excel Discussion (Misc queries) 3 June 2nd 05 07:15 PM


All times are GMT +1. The time now is 10:31 PM.

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

About Us

"It's about Microsoft Excel"