Forum Discussion
Sergio Gonçalves
Sep 26, 2017Copper Contributor
Sharing Macros
Hi.
I'm kind of new to macros but I think I've gotten the basics down. I've recorded a few macros to help my collegues with some routine formatting they do on a regular basis but I can't figure out how to get the macors to work on the other PCs. I've recorded my macros in the personal macro workbook.
Do I need to export the VBA code and then import it on the other PCs?
Can you please help me?
Thanks.
- Bill BensonCopper Contributor
Don't stop with the learning!
So... if you open the VBE using Alt F11 (better yet, add the Developer tab to your ribbon using Customize Ribbon feature), you can get into VBA easily. Every Excel workbook has a VBA project. So if you have your macros in standard code modules in your own Personal macro workbook, you can open any other workbook and click-drag the modules to the other workbook's VBA project. Thereafter you can have those users either add command buttons to the worksheet, right-click and assign macro... or else they can also add the Developer tab to their ribbons, then on that tab there is a Macros button.. which when they click will show all macros that are available to them. Just as long as "Option Private Module" does not appear at the top of the module, they should be able to see your macros and run them. Be aware of course that some macros which you might record using the Macro recorded will be VERY verbose, and do a lot of cell selection. A good idea is to google the kind of thing you were trying to do, and see how others actually code. The macro recorder is a good place to start for things like filtering, Tables, etc to get a flavor of the syntax... but never let your macros hang onto everything that the macro recorder records, it is 90% extra fluff, especially for example if you were to adjust print setup properties... whew, what a spew of details Excel puts out there!
- Sergio GonçalvesCopper Contributor
Hi Ben.
Thanks alot for the great explanation.
- Bill BensonCopper Contributor
You are welcome Sergio. And the name is Bill, not Ben. But at least 10 percent of the time anyone who has been introduced to my name in print or by voice as "Bill Benson" will respond back to "Ben". I believe it is karma I inherited because my great grandsire, upon coming to US shores in the early 1900s, changed his name from something lengthy to something easy to pronounce and which would lead to less discrimination by anti semitic types. However that may be "ben" in his ethnic tradition means "son of", so Benson is a confusing and redundant contraction. Hence my curse of being called Ben so many times I cannot count.
You may also enjoy this link: http://www.rondebruin.nl/win/code.htm
- Also if you do a search for XLSTART on your C Drive you'll find your Personal.xlsb file. You can copy that and save it on their computer in the same place.
- Sergio GonçalvesCopper ContributorThanks a lot Wyn. I'll give that a try.
Copying and pasting the code into their Personal Macro workbook is one way to go
You can also Export the module