LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,059
Default How to get address of cell calling UDF?

I'm drawing a blank....

Within a UDF, how can I get the address of the cell calling the UDF?

(Without passing ADDRESS(ROW(A1),COLUMN(A1)), if A1 is the calling cell.)

ActiveCell.Adress does not work. Activecell is the selected cell or the
first cell in a selected range at the time that the UDF is called.

I want what I would call ThisCell.Address.

For example, suppose I have the following UDF:

Function myudf()
Msgbox ThisCell.Address 'replace ThisCell
End Function

And I call it as follows from 3 cells:

A1: =RAND() + myudf()
A2: =RAND() + myudf()
A3: =RAND() + myudf()

If B1 (or any cell) is selected when I press F9, I expect 3 msgboxes (not
necessarily in order):

$A$1
$A$2
$A$3

 
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
Get cell address calling a function in C# Julien Excel Programming 0 January 14th 09 01:59 PM
Address of calling cell? DesertCyclist Excel Programming 4 October 26th 07 10:04 PM
Calling Cell (or ROW() and COLUMN() in VBA) Scott Excel Programming 2 February 13th 06 08:22 AM
Referencing Calling Cell JE McGimpsey Excel Programming 0 March 2nd 04 08:18 PM
Referencing Calling Cell Chip Pearson Excel Programming 0 March 2nd 04 08:16 PM


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