Changing Row Color
--Set the Security level to low/medium in (Tools|Macro|Security).
--Try opening a new workbook. Right click 'Sheet1' tabView code and paste
the code to the code module
--Get back to workbook and type Apple in Col G (any row)
Private Sub Worksheet_Change(ByVal Target As Range)
Dim intCIndex As Integer
If Not Application.Intersect(Target, Range("G:G")) Is Nothing Then
Select Case Ucase(Target.Text)
Case "APPLE"
intCIndex = 3
Case "GRAPE"
intCIndex = 4
Case "CORN"
intCIndex = 5
Case "ORANGE"
intCIndex = 6
End Select
If intCIndex < 0 Then
Rows(Target.Row).Interior.ColorIndex = intCIndex
Else
Rows(Target.Row).Interior.ColorIndex = 0
End If
End If
End Sub
If this post helps click Yes
---------------
Jacob Skaria
"Gs" wrote:
Thank you for responding so quickly. I did as you suggested, but it didn't
work for me. Can you help more? Do I have to do something to activate it?
I copied and pasted it in the panel and then selected File/Close and Return
to Excel. And, there aren't any colors being displayed. What am I missing?
Please......
"Jacob Skaria" wrote:
Right click the sheet tab View code and paste the below code in the code
panel...
Private Sub Worksheet_Change(ByVal Target As Range)
Dim intCIndex As Integer
If Not Application.Intersect(Target, Range("G:G")) Is Nothing Then
Select Case Target.Text
Case "Apple"
intCIndex = 3
Case "Grape"
intCIndex = 4
Case "Corn"
intCIndex = 5
Case "Orange"
intCIndex = 6
End Select
If intCIndex < 0 Then
Rows(Target.Row).Interior.ColorIndex = intCIndex
Else
Rows(Target.Row).Interior.ColorIndex = 0
End If
End If
End Sub
Refer color index for more colors
1 - Black
2 - White
3 - Red
4 - Green
5 - Blue
6 - Yellow
7 - Magenta
8 - Cyan
If this post helps click Yes
---------------
Jacob Skaria
"Gs" wrote:
I would sure appreciate some assistance in row shading / colors.
I am using Excel 2003. I have data in columns A through N, with multiple
rows. Column G has a list box / drop down box, that you make a selection from
the list. There are 6 choices in the list. I am trying to make the row color
change based on what is selected in the list in column G.
For example, when apple is selected from the list, that specific row turns
red. The next row, grape is selected and the row turns green, plum = purple,
corn = yellow, etc.
Conditional formatting allows for 3 conditions, I need 6.
Please and thank you, in advance, for any and all assistance / help /
suggesions.
Gs
|