Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Function to return interior colour of a cell

Hi I am trying to write a function to return the interior colour of a cell
which I reference. I am having difficulty getting this to work.

Basically I want to define a function like CKCellColour, use this in the
excel worksheet as a formula like =CKCellColour(M38)

Then have this function return the interior colour of cell M38

The function I have defined is as follows:

Function CKCellColour(CellRef as Range)

Range(CellRef).Select
CKCellColour = Range(CellRef).Interior.ColorIndex

End Function

This function never seems to get the range ref. Can someone help me solve
this problem.

Thanks for your help in advance.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Function to return interior colour of a cell

Hi G Man,

Try this adaptation;

'=============
Function CKCellColour(CellRef As Range)

CKCellColour = CellRef.Interior.ColorIndex

End Function
'<<=============


--
---
Regards,
Norman



"G Man" wrote in message
...
Hi I am trying to write a function to return the interior colour of a cell
which I reference. I am having difficulty getting this to work.

Basically I want to define a function like CKCellColour, use this in the
excel worksheet as a formula like =CKCellColour(M38)

Then have this function return the interior colour of cell M38

The function I have defined is as follows:

Function CKCellColour(CellRef as Range)

Range(CellRef).Select
CKCellColour = Range(CellRef).Interior.ColorIndex

End Function

This function never seems to get the range ref. Can someone help me solve
this problem.

Thanks for your help in advance.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Function to return interior colour of a cell

Try:

Function CKCellColour(CellRef As Range)
CKCellColour = CellRef.Interior.ColorIndex
End Function

"G Man" wrote:

Hi I am trying to write a function to return the interior colour of a cell
which I reference. I am having difficulty getting this to work.

Basically I want to define a function like CKCellColour, use this in the
excel worksheet as a formula like =CKCellColour(M38)

Then have this function return the interior colour of cell M38

The function I have defined is as follows:

Function CKCellColour(CellRef as Range)

Range(CellRef).Select
CKCellColour = Range(CellRef).Interior.ColorIndex

End Function

This function never seems to get the range ref. Can someone help me solve
this problem.

Thanks for your help in advance.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Function to return interior colour of a cell

Many thanks this does the job nicely.

One last small question, is there a way for to get the recalc function to
rerun this function so that it picks up changes of interior cells given
conditional formating?

"Norman Jones" wrote:

Hi G Man,

Try this adaptation;

'=============
Function CKCellColour(CellRef As Range)

CKCellColour = CellRef.Interior.ColorIndex

End Function
'<<=============


--
---
Regards,
Norman



"G Man" wrote in message
...
Hi I am trying to write a function to return the interior colour of a cell
which I reference. I am having difficulty getting this to work.

Basically I want to define a function like CKCellColour, use this in the
excel worksheet as a formula like =CKCellColour(M38)

Then have this function return the interior colour of cell M38

The function I have defined is as follows:

Function CKCellColour(CellRef as Range)

Range(CellRef).Select
CKCellColour = Range(CellRef).Interior.ColorIndex

End Function

This function never seems to get the range ref. Can someone help me solve
this problem.

Thanks for your help in advance.





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Function to return interior colour of a cell

Take a look at this link for more info on conditional formatted colors...

http://www.cpearson.com/excel/CFColors.htm

--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

That function will not recognize conditional formats. Conditional formats do
not actually set the interior color of the cell. Application.volitile will
ensure that the function is re-evelauted every time the spreadsheet is
recalced. Place that at the top of the code.
--
HTH...

Jim Thomlinson


"G Man" wrote:

Many thanks this does the job nicely.

One last small question, is there a way for to get the recalc function to
rerun this function so that it picks up changes of interior cells given
conditional formating?

"Norman Jones" wrote:

Hi G Man,

Try this adaptation;

'=============
Function CKCellColour(CellRef As Range)

CKCellColour = CellRef.Interior.ColorIndex

End Function
'<<=============


--
---
Regards,
Norman



"G Man" wrote in message
...
Hi I am trying to write a function to return the interior colour of a cell
which I reference. I am having difficulty getting this to work.

Basically I want to define a function like CKCellColour, use this in the
excel worksheet as a formula like =CKCellColour(M38)

Then have this function return the interior colour of cell M38

The function I have defined is as follows:

Function CKCellColour(CellRef as Range)

Range(CellRef).Select
CKCellColour = Range(CellRef).Interior.ColorIndex

End Function

This function never seems to get the range ref. Can someone help me solve
this problem.

Thanks for your help in advance.







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Function to return interior colour of a cell

That function will not recognize conditional formats. Conditional formats do
not actually set the interior color of the cell. Application.volitile will
ensure that the function is re-evelauted every time the spreadsheet is
recalced. Place that at the top of the code.
--
HTH...

Jim Thomlinson


"G Man" wrote:

Many thanks this does the job nicely.

One last small question, is there a way for to get the recalc function to
rerun this function so that it picks up changes of interior cells given
conditional formating?

"Norman Jones" wrote:

Hi G Man,

Try this adaptation;

'=============
Function CKCellColour(CellRef As Range)

CKCellColour = CellRef.Interior.ColorIndex

End Function
'<<=============


--
---
Regards,
Norman



"G Man" wrote in message
...
Hi I am trying to write a function to return the interior colour of a cell
which I reference. I am having difficulty getting this to work.

Basically I want to define a function like CKCellColour, use this in the
excel worksheet as a formula like =CKCellColour(M38)

Then have this function return the interior colour of cell M38

The function I have defined is as follows:

Function CKCellColour(CellRef as Range)

Range(CellRef).Select
CKCellColour = Range(CellRef).Interior.ColorIndex

End Function

This function never seems to get the range ref. Can someone help me solve
this problem.

Thanks for your help in advance.





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Function to return interior colour of a cell

and this http://www.xldynamic.com/source/xld.CFConditions.html

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Jim Thomlinson" wrote in message
...
Take a look at this link for more info on conditional formatted colors...

http://www.cpearson.com/excel/CFColors.htm

--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

That function will not recognize conditional formats. Conditional

formats do
not actually set the interior color of the cell. Application.volitile

will
ensure that the function is re-evelauted every time the spreadsheet is
recalced. Place that at the top of the code.
--
HTH...

Jim Thomlinson


"G Man" wrote:

Many thanks this does the job nicely.

One last small question, is there a way for to get the recalc function

to
rerun this function so that it picks up changes of interior cells

given
conditional formating?

"Norman Jones" wrote:

Hi G Man,

Try this adaptation;

'=============
Function CKCellColour(CellRef As Range)

CKCellColour = CellRef.Interior.ColorIndex

End Function
'<<=============


--
---
Regards,
Norman



"G Man" wrote in message
...
Hi I am trying to write a function to return the interior colour

of a cell
which I reference. I am having difficulty getting this to work.

Basically I want to define a function like CKCellColour, use this

in the
excel worksheet as a formula like =CKCellColour(M38)

Then have this function return the interior colour of cell M38

The function I have defined is as follows:

Function CKCellColour(CellRef as Range)

Range(CellRef).Select
CKCellColour = Range(CellRef).Interior.ColorIndex

End Function

This function never seems to get the range ref. Can someone help

me solve
this problem.

Thanks for your help in advance.







  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Function to return interior colour of a cell

Great reference Bob. I had not seen that one. The author sound fimilair so I
guess I will trust the code.
--
HTH...

Jim Thomlinson


"Bob Phillips" wrote:

and this http://www.xldynamic.com/source/xld.CFConditions.html

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Jim Thomlinson" wrote in message
...
Take a look at this link for more info on conditional formatted colors...

http://www.cpearson.com/excel/CFColors.htm

--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

That function will not recognize conditional formats. Conditional

formats do
not actually set the interior color of the cell. Application.volitile

will
ensure that the function is re-evelauted every time the spreadsheet is
recalced. Place that at the top of the code.
--
HTH...

Jim Thomlinson


"G Man" wrote:

Many thanks this does the job nicely.

One last small question, is there a way for to get the recalc function

to
rerun this function so that it picks up changes of interior cells

given
conditional formating?

"Norman Jones" wrote:

Hi G Man,

Try this adaptation;

'=============
Function CKCellColour(CellRef As Range)

CKCellColour = CellRef.Interior.ColorIndex

End Function
'<<=============


--
---
Regards,
Norman



"G Man" wrote in message
...
Hi I am trying to write a function to return the interior colour

of a cell
which I reference. I am having difficulty getting this to work.

Basically I want to define a function like CKCellColour, use this

in the
excel worksheet as a formula like =CKCellColour(M38)

Then have this function return the interior colour of cell M38

The function I have defined is as follows:

Function CKCellColour(CellRef as Range)

Range(CellRef).Select
CKCellColour = Range(CellRef).Interior.ColorIndex

End Function

This function never seems to get the range ref. Can someone help

me solve
this problem.

Thanks for your help in advance.








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
Test cell interior color by worksheet function? Skimmer Excel Worksheet Functions 7 September 4th 07 09:40 PM
Finding Cell Interior Colour of First Cell in Column ExcelMonkey[_190_] Excel Programming 4 March 22nd 05 03:01 AM
Function to return colour of formatted cell ExcelMonkey Excel Worksheet Functions 3 November 1st 04 05:54 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


All times are GMT +1. The time now is 07:42 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"