PDA

View Full Version : Solved: Fill Color issues



grichey
10-22-2007, 01:23 PM
Hello,
I am trying to color certain rows blue and certain columns black for dividing my sheet and making it more readable. As best I can tell the code is right but it isn't coloring anything.
Suggestions?

Thanks.
Sheets("1.12").Select
Cells.Select
Selection.Interior.ColorIndex = x1None
Range("85:85").Select
With Selection.Interior.ColorIndex = 37
'.Pattern = x1Solid
End With

Columns("U:U").ColumnWidth = 0.83
Columns("U:U").Select
With Selection.Interior.ColorIndex = 1
'.Pattern = x1Solid
End With

Bob Phillips
10-22-2007, 01:28 PM
With Sheets("1.12")
.Cells.Interior.ColorIndex = xlColorIndexNone
With .Rows(85)
.Interior.ColorIndex = 37
End With
End With

grichey
10-22-2007, 01:47 PM
I tried using that code but got a subscript error. What am I missing here?
Sub addTtlClr()
With Sheets("1.10")
.Cells.Interior.ColorIndex = x1ColorIndexNone
With .Rows(11, 12, 20, 21, 30, 32, 39, 40, 42, 43, 45, 47, 49, 51)
.Interior.ColorIndex = 37
End With
End With

Bob Phillips
10-22-2007, 02:03 PM
Do you have a worksheet called 1.10 because that is what is throwing the error?

You also cannot reference rows like that.

grichey
10-22-2007, 02:06 PM
Yeah I have sheets 1.10, 1.12, 1.14. Sorry for the confusion. I'm trying to change say 5 different rows to blue fill as they represent totals.
I have the following in my macro which causes no error to come up but it doesn't color the cells like it's supposed. It removes the existing colors but doesn't add back the blue (color 37).

Thanks.

'Sheets("1.10").Select
'Cells.Select
'Selection.Interior.ColorIndex = x1None
'Range("11:12, 20:21, 30:32, 39:40, 42:43, 45:47, 49:51").Select
'With Selection.Interior.ColorIndex = 37
'.Pattern = x1Solid
'End With

Bob Phillips
10-22-2007, 02:21 PM
This works fine for me



With Sheets("1.10")
.Cells.Interior.ColorIndex = xlColorIndexNone
.Range("11:12, 20:21, 30:32, 39:40, 42:43, 45:47, 49:51").Interior.ColorIndex = 37
End With

grichey
10-22-2007, 02:28 PM
I must be losing my mind.

Thanks for the help!!