Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Finding Cell Interior Colour of First Cell in Column

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Finding Cell Interior Colour of First Cell in Column

Hi, the folowing line of code will place in a variable the integer
value of the interior color of the first cell in the column of a range
called 'NmdRnge":

myColor = Cells(1, Range(NmdRnge).Column).Interior.ColorIndex

HTH--Lonnie M.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Finding Cell Interior Colour of First Cell in Column

Not sure I fully understand, but here goes

myVar = Cells(1,Range("the_named_cell").Column).Interior.C olorindex

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ExcelMonkey" wrote in message
...
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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Finding Cell Interior Colour of First Cell in Column

if the named cell is named Dog then

range("Dog").EntireColumn.cells(1).Interior.Color


--
Regards,
Tom Ogilvy

"ExcelMonkey" wrote in message
...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding last occurence of Interior.ColorIndex 36 Linda New Users to Excel 2 May 28th 10 07:04 AM
Cell interior color JohnB Excel Discussion (Misc queries) 4 October 12th 06 06:07 PM
Code to change interior colour only if current interior colour is BeSmart Excel Programming 2 October 5th 04 12:06 AM
Conditional Format with VBA - Interior Colour of cell based on value from in-cell dropdown Steve[_52_] Excel Programming 5 June 15th 04 11:45 AM
Interior Cell color Pellechi Excel Programming 1 September 23rd 03 03:39 PM


All times are GMT +1. The time now is 12:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"