ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   identify first macro run (https://www.excelbanter.com/excel-programming/424790-identify-first-macro-run.html)

sunilpatel

identify first macro run
 
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?



Dave Peterson

identify first macro run
 
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).valu e _
"NameOfThisMacro"
end with

And you could inspect that whenever you wanted.

sunilpatel wrote:

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?


--

Dave Peterson


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

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