View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_3_] Jim Thomlinson[_3_] is offline
external usenet poster
 
Posts: 983
Default Finding Cell Interior Colour of First Cell in Column

Here it is... xlUp may not work for you if you had a blank cell in the column
so I used the intersect method...

Option Explicit

Sub test()
MsgBox GetCellColour
End Sub

Public Function GetCellColour() As Long
GetCellColour = Intersect(ActiveSheet.Rows(1),
ActiveCell.EntireColumn).Interior.ColorIndex
End Function

HTH

"ExcelMonkey" wrote:

I have a column with data in it. The column grows over
time during a sub routine (i.e. it get longer) I want to
pass the first cells (say A1) interior colour to a
variable. However none of the cells in the column are
named except the most recent addition (say A30). I want
to be able to take the named cell extract from that the
first cell in that columns address. Similar to doing an
xlUp from the named cell.

Is the xlUP the only way I can do this. And if so, what
do I do after the xlUp to actuallly select the first
cell. I was hoping I could do this without selecting
cells.

Thanks