ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   function to figure out which procedure (https://www.excelbanter.com/excel-programming/372988-function-figure-out-procedure.html)

Monique

function to figure out which procedure
 
i need to create a function that will figure out which procedure called it
and then run the appropriate procedure based on that call.

re-wording...:::
i have several procedures that will call the same procedure.
depending on the procedure calling the procedure, another procedure is called.

or this can be done with a function... and then i will produce the results
and the procedure name

any help will be appreciated.

Die_Another_Day

function to figure out which procedure
 
Monique, add an optional string to your function.
Function XYZ(Parameters as Variant, Optional Caller as String) as
Integer
'Your code
End Function

Then call it like this:
i = XYZ(Param1, "MySub")

Charles Chickering

Monique wrote:
i need to create a function that will figure out which procedure called it
and then run the appropriate procedure based on that call.

re-wording...:::
i have several procedures that will call the same procedure.
depending on the procedure calling the procedure, another procedure is called.

or this can be done with a function... and then i will produce the results
and the procedure name

any help will be appreciated.



NickHK[_3_]

function to figure out which procedure
 
Monique,
The only practical way is to have an argument in your called function that
take the name of the calling routine.
Then based your the call to subsequent routines based on that.

Function Calling
Call Called ("Calling")
End Function

Function Called (WhoCalledMe As String)
Select Case WhoCalledMe
Case "Calling"
'Decide what to do
Case Else
MsgBox "No folllowing routine specified"
End Select
End Function

NickHK

"Monique" ...
i need to create a function that will figure out which procedure called it
and then run the appropriate procedure based on that call.

re-wording...:::
i have several procedures that will call the same procedure.
depending on the procedure calling the procedure, another procedure is
called.

or this can be done with a function... and then i will produce the results
and the procedure name

any help will be appreciated.





All times are GMT +1. The time now is 12:06 AM.

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