identify first macro run

S

sunilpatel

when someone using my workbook runs one of my 5 macros using
"tools-macro-macro-run...." Depending on which one is started, a different
order of macros are run. Hence i need to capture the name of the first macro
that was run by the user. Is this possible?
 
D

Dave Peterson

Maybe you could use a hidden worksheet that can be populated with the name of
the macro.

Clear the range first (if you want), then each macro would write its name in the
next available cell.

Option Explicit
Sub Auto_Open()
with worksheets("HiddenSheetNameHere")
.cells.clear
.range("a1").value = "Order of Macs"
end with
End sub

Then each macro would have something like:

with worksheets("HiddenSheetNameHere")
.cells(.rows.count,"A").end(xlup).offset(1,0).value _
"NameOfThisMacro"
end with

And you could inspect that whenever you wanted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top