How to find out where an Excel macro is triggered from
May 9, 2016 1:39 AM   Subscribe

How can I find out if 2 macros in an inherited Excel spreadsheet are actually needed, or if they are 'orphan'?

I am fairly competent in Excel & am helping a colleague to troubleshoot an Excel spreadsheet. This is a complex workbook, built for my colleague by a member of the IT dept who is no longer working for the company. I have had a good look around the formulas & macros & all seems pretty clear, except that there are two macros that appear to be totally unused. The other macros all have a button on one of the sheets to trigger them, but these 2 do not. They are not triggered by any of the other macros, as far as I can see. The user is not running them manually, either by using the Developer ribbon, or a keyboard shortcut. There is no ThisWorkbook module to run the VBA on save.

Is there any where else that these two macros could be being used, or are they just redundant & can be deleted?
posted by cantthinkofagoodname to Computers & Internet (6 answers total)
 
I dunno, but if you delete them, keep copies!
posted by Segundus at 2:52 AM on May 9, 2016 [1 favorite]


Make a backup copy of the spreadsheet, delete the macros, see if there's a problem. If there's a problem, you have the backup ready to go.
posted by jeather at 4:00 AM on May 9, 2016


i think this might tell you?
posted by andrewcooke at 4:27 AM on May 9, 2016


Alternatively you could just comment out the macro code, so that if it turns out you need them you don't have to revert to an old version or add in the macros again, you can just uncomment the code.
posted by EndsOfInvention at 5:27 AM on May 9, 2016 [6 favorites]


2nding the commenting out. Slight pain to do so, but easy to reactivate if/when needed.
posted by Hactar at 1:40 PM on May 9, 2016


the trouble with commenting out is how do you know if the macro is unused, or unused just for the particular data you have right now?

it's the kind of solution that's ok if you're in some kind of amazing dev environment with tests up the wazoo, or if you're just don't give a damn. but there's a kind of pragmatic middle ground where you can be reasonably concerned that even if it works ok today, a week down the line when your boss changes some numbers, all hell breaks loose.
posted by andrewcooke at 1:52 PM on May 9, 2016


« Older Retina MacBook, Port me away!   |   Rebuilding trust in my relationship Newer »
This thread is closed to new comments.