Forum Discussion
Multiple Excel Macros For Different Functions
It'd be easier to store the macros in the workbooks themselves.
When you copy one of the existing workbooks for a new month, you'll copy the macros with it, so the same macros will be available in the new copy.
Hans - can you tell me what i'm missing? I've had this on the back burner for other priorities but looked at one example this morning. If in the VBA editor window opened only on a single excel workbook where i made (and thought i saved) three macros specific to that workbooks function, i see all the macros in a module folder under that workbooks title...
And yet when i go to add buttons/icons for these to the ribbon or tool bar, i see them ONLY when i select "Add To All Documents" - shot one below, and they disappear when I select "For Downtime Rollup" only. My goal is to make them only available in Downtime Rollup. Did i save them wrong somehow?
Thanks
Joe
- HansVogelaarMar 02, 2022MVP
That is strange. could you attach a copy of the workbook, or make it available through OneDrive, Google Drive, Dropbox or similar?
- JoeCavasinMar 04, 2022Brass Contributor
Yay! glad it also looks weird to someone else - who knows more of this stuff. It's been confusing the hell out of me. I've attached, and hope it's helpful. I'm sure the macros will be problematic if you need to test since they are all programmed to refer to specific share drive locations the sheet won't be able to access from this forum location...
I figure worst case, perhaps i can export the macros, save, and then reimport "to this workbook" only, and save a new version?
Thanks!
Joe
- HansVogelaarMar 04, 2022MVP
The cause of the problem is that the macros have the same name as the modules they're in.
I changed the names of the modules:
The macros then remain visible:
Remarks:
- You renamed the workbook module ThisWorkbook to Copy_Out. That is not a good idea; ThisWorkbook has a special meaning, so renaming it is confusing.
- You stored a standard macro Copy_Out in the workbook module. Although this is allowed, it is not a good idea either: the workbook module is intended for workbook-level event procedures such as Workbook_Open. Standard macros belong in standard modules - the kind you create by selecting Insert > Module.