ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I find which cell called a function? (https://www.excelbanter.com/excel-programming/271462-how-do-i-find-cell-called-function.html)

TL[_2_]

How do I find which cell called a function?
 
I have a user function called from a cell on the
spreadsheet which draws a line based on input from
ajoining cells.

The cell content looks like this:

=LinkDraw(x1,y1,x2,y2)

The value of the cell is just 0 for fail and 1 for success.

Works great, but now I need to be able to determine, from
within the LinkDraw() function, which cell called the
function.

Ideally, I would like to do this without any kludgy
nonsense like feeding the answer as an input variable:

=LinkDraw(x1,y1,x2,y2,CELL(row),CELL(col)) <-Yucky.

Any suggestions?
-TL

J.E. McGimpsey

How do I find which cell called a function?
 
Take a look at the Application.Caller property in Help.

In article ,
"TL" wrote:

I have a user function called from a cell on the
spreadsheet which draws a line based on input from
ajoining cells.

The cell content looks like this:

=LinkDraw(x1,y1,x2,y2)

The value of the cell is just 0 for fail and 1 for success.

Works great, but now I need to be able to determine, from
within the LinkDraw() function, which cell called the
function.

Ideally, I would like to do this without any kludgy
nonsense like feeding the answer as an input variable:

=LinkDraw(x1,y1,x2,y2,CELL(row),CELL(col)) <-Yucky.

Any suggestions?
-TL


Alan Beban[_3_]

How do I find which cell called a function?
 
If Type Of Application.Caller Is Range Then
Msgbox Application.Caller.Address
End if

Alan Beban

TL wrote:
I have a user function called from a cell on the
spreadsheet which draws a line based on input from
ajoining cells.

The cell content looks like this:

=LinkDraw(x1,y1,x2,y2)

The value of the cell is just 0 for fail and 1 for success.

Works great, but now I need to be able to determine, from
within the LinkDraw() function, which cell called the
function.

Ideally, I would like to do this without any kludgy
nonsense like feeding the answer as an input variable:

=LinkDraw(x1,y1,x2,y2,CELL(row),CELL(col)) <-Yucky.

Any suggestions?
-TL



TL[_3_]

How do I find which cell called a function?
 
That works -- Thanks!
-TL

-----Original Message-----
If Type Of Application.Caller Is Range Then
Msgbox Application.Caller.Address
End if

Alan Beban

TL wrote:
I have a user function called from a cell on the
spreadsheet which draws a line based on input from
ajoining cells.

The cell content looks like this:

=LinkDraw(x1,y1,x2,y2)

The value of the cell is just 0 for fail and 1 for

success.

Works great, but now I need to be able to determine,

from
within the LinkDraw() function, which cell called the
function.

Ideally, I would like to do this without any kludgy
nonsense like feeding the answer as an input variable:

=LinkDraw(x1,y1,x2,y2,CELL(row),CELL(col)) <-Yucky.

Any suggestions?
-TL


.



All times are GMT +1. The time now is 11:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com