I'm looking for VBA code under which we can determine the index of the last cell (predefined color) in a column columns.
Example: The column containing colored cells up to the line 650, how to get this 650?
Here is a small code, for this purpose:
'for the test we will use a yellow background = 6 sur 20 ligne
' the last line is no 30
a = Range("A1").Interior.ColorIndex
col = CountColor_bacgroung(Range("A1:A120"), 6)
s = MsgBox("the last cell is : " & col, vbInformation, " line of color")
Function CountColor_bacgroung(Index As Range, Color As Long) As Long
Dim C As Variant
X = 0
For Each C In Plage
If C.Interior.ColorIndex = Color Then
X = C.Row
Thanks to Bidouilleu_R for this tip.
Published by jak58
Latest update on July 18, 2010 at 09:17 AM by jak58.