LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 177
Default Color Row Macro Problem, adapted from Patrick Malloy macro

I'm trying to adapt a macro by Patrick Malloy MVP, and this is what I now
have. It's not working. Wondering if anyone has any suggestions.

At first try nothing happened. Then I changed
With .Range(.Cells(cell.Row, "A"), .Cells(cell.Row, "Z"))
to
With .Range(.Cells(cell.Row, "A1"), .Cells(cell.Row, "Z3000"))

Second try now I get an error:
Compile error: Constant expression required
with the debugger highlighting "green" in
Case "Advertising"
color = Colors.green

Any suggestions? Thanks very much!

Option Explicit
Enum Colors
green = 35
yellow = 36
blue = 34
White = 2
End Enum
Sub Update_Report_Colors()
Dim sheet As Worksheet
Dim i As Integer
Dim keycol As Long
Dim cell As Range
Dim found As Range
Dim color As Long
Set sheet = Worksheets("HotList")

keycol = 2

With sheet
Set found = .Columns(keycol).SpecialCells(xlCellTypeFormulas)
For Each cell In found
Select Case cell.Value

Case "Advertising"
color = Colors.green

Case "Apparel Retail"
color = Colors.yellow

Case "Apparel, Accessories and Luxury Goods"
color = Colors.blue

Case "Auto Components"
color = Colors.green

Case "Auto Parts and Equipment"
color = Colors.yellow

Case "Automobile Manufacturers"
color = Colors.blue

Case "Automobiles"
color = Colors.green

Case "Automobiles and Components"
color = Colors.yellow

Case "Automotive Retail"
color = Colors.blue

Case "Broadcasting and Cable TV"
color = Colors.green

'About 200 more cases and then...

Case Else
color = Colors.White
End Select

With .Range(.Cells(cell.Row, "A1"), .Cells(cell.Row, "Z3000"))
.Interior.ColorIndex = color
End With
Next

End With

End Sub
 
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
Make text color match cell color with macro? JoeSpareBedroom Excel Discussion (Misc queries) 1 June 26th 07 07:09 PM
Problem in updating all worksheets of a workbook using a macro that calls another macro [email protected] Excel Programming 3 March 20th 06 05:21 AM
Problem running row color macro cralston Excel Programming 9 March 2nd 06 06:09 PM
fao patrick molloy neilwebb[_2_] Excel Programming 1 June 20th 05 03:43 PM
Patrick- do you still have the file Jennifer Excel Programming 1 April 12th 05 07:51 AM


All times are GMT +1. The time now is 05:44 PM.

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

About Us

"It's about Microsoft Excel"