Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default From which cell is my VBA function called ?

I have a VBA function that is called from many cells in several worksheets
in my workbook. The function performs some error trapping (data checking)
and gives a message if an error is found.

However, I need to retrieve information on from where the erroneous call of
the function is placed (sheet and cell).

Is it possible to get this information by VBA ?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default From which cell is my VBA function called ?

Application.Caller.Address

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Helge V. Larsen" wrote in message
...
|I have a VBA function that is called from many cells in several worksheets
| in my workbook. The function performs some error trapping (data checking)
| and gives a message if an error is found.
|
| However, I need to retrieve information on from where the erroneous call of
| the function is placed (sheet and cell).
|
| Is it possible to get this information by VBA ?
|
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default From which cell is my VBA function called ?

However, I need to retrieve information on from where the erroneous
call of
the function is placed (sheet and cell).



Would the "Caller" property work?

Function MyFunction(x)
If TypeName(Application.Caller) = "Range" Then
Debug.Print Application.Caller.Address(External:=True)
'or maybe
Debug.Print Application.Caller.Address(False, False, , True)
End If
MyFunction = x * x
End Function

HTH
Dana DeLouis


Helge V. Larsen wrote:
I have a VBA function that is called from many cells in several worksheets
in my workbook. The function performs some error trapping (data checking)
and gives a message if an error is found.

However, I need to retrieve information on from where the erroneous call of
the function is placed (sheet and cell).

Is it possible to get this information by VBA ?


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
How do I know which cell a function is called from? Murami Excel Worksheet Functions 3 November 24th 06 02:22 PM
Need to know what cell called the custom VBA function? partyOfOne Excel Programming 1 September 19th 05 05:06 PM
How do I copy a function with a called cell constant? MitchCarter1957 Excel Worksheet Functions 1 September 6th 05 05:26 PM
Find out which cell that called my function Anders Excel Programming 3 July 14th 05 11:46 AM
How do I find which cell called a function? TL[_2_] Excel Programming 3 July 12th 03 02:12 AM


All times are GMT +1. The time now is 12:02 PM.

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"