Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 234
Default Refer to the cell in which a function is entered.

My function points to a range, and I want it to count all the cells in the range that are the same colour as the cell in which the function is entered. How can I refer to the cell
Thanks in advanc
Ro

Function CountSameColour(MyRange as excel.range
for each cell in myrang
if cell.interior.colorindex={{{{{{{{this cell}}}}}}}}.interior.colorindex the
countsamecolour=countsamecolour+
end i
nex
End Function
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Refer to the cell in which a function is entered.

Application.Caller

--
Regards,
Tom Ogilvy

"Rob" wrote in message
...
My function points to a range, and I want it to count all the cells in the

range that are the same colour as the cell in which the function is entered.
How can I refer to the cell?
Thanks in advance
Rob

Function CountSameColour(MyRange as excel.range)
for each cell in myrange
if cell.interior.colorindex={{{{{{{{this

cell}}}}}}}}.interior.colorindex then
countsamecolour=countsamecolour+1
end if
next
End Function



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Refer to the cell in which a function is entered.

Hi
use
application.caller
for this

Note: The return value won't change if you only change the
format of this cell (this won't force a re-calculation)

-----Original Message-----
My function points to a range, and I want it to count all

the cells in the range that are the same colour as the
cell in which the function is entered. How can I refer to
the cell?
Thanks in advance
Rob

Function CountSameColour(MyRange as excel.range)
for each cell in myrange
if cell.interior.colorindex={{{{{{{{this

cell}}}}}}}}.interior.colorindex then
countsamecolour=countsamecolour+1
end if
next
End Function
.

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
Rank Function: Refer to more than one range Gary T Excel Worksheet Functions 4 September 23rd 08 06:10 PM
How do I refer to the results of a function in a cell not the form James Lucero[_2_] Excel Worksheet Functions 2 April 28th 08 10:10 PM
How to refer to a text piece in a VBA custom function? FARAZ QURESHI Excel Discussion (Misc queries) 2 January 27th 08 03:11 PM
Refer to Named Range on another sheet for IF function David Excel Worksheet Functions 3 August 26th 06 04:12 AM
have input box. Need criteria entered to refer to cond. format criteria Bob Phillips[_6_] Excel Programming 0 March 1st 04 08:17 PM


All times are GMT +1. The time now is 07:18 AM.

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

About Us

"It's about Microsoft Excel"