![]() |
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 ? |
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 ? | | |
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 ? |
All times are GMT +1. The time now is 10:30 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com