View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Changing Row Color

hi
you said you "pasted it in the panal".
did you paste it into a standard module or a sheet module? the code that
Jacob supplied is sheet code. right click the sheet tab that you want the
code to run on and from the popup, click view code. paste it there.

Regards
FSt1

"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