View Single Post
  #2  
Old May 27th, 2010, 10:56 PM posted to microsoft.public.excel.newusers
Don Guillett[_2_]
external usenet poster
 
Posts: 607
Default Finding last occurence of Interior.ColorIndex 36

The trick is to work from the bottom up. Change col "j" to suit

Sub FindLastColor36_SAS()
mc = "j"
For i = Cells(Rows.Count, mc).End(xlUp).Row To 1 Step -1
'MsgBox Cells(i, mc).Interior.ColorIndex
If Cells(i, mc).Interior.ColorIndex = 36 Then
Exit For
End If
Next i
MsgBox "Found at row " & i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Linda" wrote in message
...
I have been searching for a formula to help me find the last time (most
recent) color 36 appears in a column of colored cells. Most of the time
there
is no typed information and when there is, it is not the same for every
color
36 cell. The cells are not conditionally formatted. C. Pearson's site is
great, but I can't find what I need. I don't want to change color, I
don't
want to know how many times it shows up, I just want to find the last time
it
is in the column. I could count down to find it, but there are over
15,000
columns spread over several worksheets. I have Excel 2003. I'm pretty
formula illiterate, it takes me days to get a formula to work and even
then
I'm not sure how I got it to work.

In my reading it seems VBA (?) would work, I think it is what macros use
and
I have cut and pasted from my macros to make things work, but I'm getting
nowhere fast with this problem.



--
Many Thanks.