ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   IF: color of cell color next row (https://www.excelbanter.com/excel-programming/284195-if-color-cell-color-next-row.html)

John Childs[_2_]

IF: color of cell color next row
 
I've got an Excel sheet that I'm trying to make more readable by sorting/grouping numbers in column 2, and
making one grouping of rows/column 2 numbers with no fill color (Interior.ColorIndex = x1none). When
the number in Column 2 changes, I want to go from "no color" to Interior.ColorIndex = 35

What I need to know is how to look at the color of a cell in row 1 and determine if the corresponding cell in
row 2 is different. And if it is different, then row 2 gets Interior.ColorIndex = 35. Below is what I've tried s
far that doesn't work. Many thanks, John

If Cells(rowctr, 2) < Cells(rowctr + 1, 2) The
Range("A" & rowctr).Selec
If ActiveCell.Interior.ColorIndex = x1none The
Range("A" & rowctr + 1, "L" & rowctr + 1).Selec
With Selection.Interio
.ColorIndex = 3
End Wit
End I

If Selection.Interior.ColorIndex = 35 The
Range("A" & rowctr + 1).Selec
With Selection.Interio
.ColorIndex = x1non
End Wit
End I
End If

mudraker[_48_]

IF: color of cell color next row
 

If Cells(rowctr, 2).Interior.ColorIndex < Cells(rowctr + 1
2).Interior.ColorIndex Then
Cells(rowctr + 1, 2).Interior.ColorIndex = 35
End I

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements


All times are GMT +1. The time now is 07:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com