Thread: Format rows
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Format rows

Not imp;ossible at all.

Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("A1")
On Error GoTo endit
Application.EnableEvents = False
vals = Array("Item1", "Item2", "Item3", "Item4", "Item5")
nums = Array(8, 9, 6, 3, 7, 4)
icolor = 0
For i = LBound(vals) To UBound(vals)
If r.Value = vals(i) Then
icolor = nums(i)
End If
Next
If icolor 0 Then
r.EntireRow.Interior.ColorIndex = icolor
End If
endit:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste the above into that sheet module.

Assumes A1 has the DV list dropdown.

Edit Item names and colors to suit.


Gord Dibben MS Excel MVP


On Mon, 25 Feb 2008 06:51:08 -0800, FDA wrote:

I am workin on a sheet that I would like to do the impossible.

I am creating a drop down list of topics. I would like to assign a color to
each topic and have excell highlight the row depending on the topic. Is this
truely imposible?