Sub is this possible

mole999

Moderator
Joined
Oct 23, 2004
Messages
10,281
Office Version
2019, 2016, 2013
Platform
Windows
I'm having a big problem with a set of routines (I won't explain them) Is it possible to call a routine from a Sub, and return the ID of the calling Sub (maybe its not worth doing) I want to list each sub entry and a time stamp to be able to focus down on what the issue is

Sub One
Reporting
End Sub

Sub Two
Reporting
End Sub


Sub Reporting
Last Row of reporting page
stamp with calling Sub (ID) and time stamp
End Sub

One 07:00:01
Two 07:00:02
 

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,261
Code:
[color=darkblue]Sub[/color] One()
Reporting "One"
[color=darkblue]End[/color] [color=darkblue]Sub[/color]


[color=darkblue]Sub[/color] Two()
Reporting "Two"
[color=darkblue]End[/color] Sub


[color=darkblue]Sub[/color] Reporting(strCaller)
[color=green]'Last Row of reporting page[/color]
[color=green]'stamp with calling Sub (ID) and time stamp[/color]
Debug.Print strCaller & ", " & Now
[color=darkblue]End[/color] Sub
 

mole999

Moderator
Joined
Oct 23, 2004
Messages
10,281
Office Version
2019, 2016, 2013
Platform
Windows
Thank you, I didn't know what to search for
 

=ODIN=

Active Member
Joined
Dec 3, 2009
Messages
288
It seems like that might miss the point Alpha. It seems like they were trying to figure out if there was a way to programatically figure out the sub name so they could just use

Code:
Sub One()
Reporting "thisSub.name"
End Sub"

Sub Reporting (strCaller)
Debug.print strCaller & ", " & Now"
End Sub
and paste in
Code:
Reporting "thisSub.name"
to each sub without having to manually update the sub name.

EDIT---> I take it back. They seem happy with that. OP Seems happy with that. My bad.
 
Last edited:

mole999

Moderator
Joined
Oct 23, 2004
Messages
10,281
Office Version
2019, 2016, 2013
Platform
Windows
It seems like that might miss the point Alpha. It seems like they were trying to figure out if there was a way to programatically figure out the sub name so they could just use

Code:
Sub One()
Reporting "thisSub.name"
End Sub"

Sub Reporting (strCaller)
Debug.print strCaller & ", " & Now"
End Sub
and paste in
Code:
Reporting "thisSub.name"
to each sub without having to manually update the sub name.

EDIT---> I take it back. They seem happy with that. OP Seems happy with that. My bad.
No need to take it back, having options is always useful. the single use sub identifier is what I am after, easy to comment out or in globally
 

mole999

Moderator
Joined
Oct 23, 2004
Messages
10,281
Office Version
2019, 2016, 2013
Platform
Windows
Thank you for the research. I had started to implement a label by label identifier. It has shown some issues which have been corrected
 

Watch MrExcel Video

Forum statistics

Threads
1,095,388
Messages
5,444,187
Members
405,272
Latest member
skipowers

This Week's Hot Topics

Top