Sub is this possible

mole999

Well-known Member
Joined
Oct 23, 2004
Messages
10,524
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. 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
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
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
 
Upvote 0
Thank you, I didn't know what to search for
 
Upvote 0
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:
Upvote 0
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
 
Upvote 0
Thank you for the research. I had started to implement a label by label identifier. It has shown some issues which have been corrected
 
Upvote 0

Forum statistics

Threads
1,214,406
Messages
6,119,330
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top