1

enter image description here

Just like Visual Studio allows us to drag our favourite code to toolbox and then use it later in any project. Do VBA allows this kind of functionality by any chance.? What is the best way to manage the favourtie/reptitive vba code which i can use it in multiple workbooks?

Community
  • 1
  • 1

3 Answers3

1

In Excel you can possibly use Personal.XLSB file which could be a kind of container for all subroutines which you refer to quite often. You can create and organise them in modules, class modules. Some UserForms can be placed there as well. Each time you open Excel Personal.XLSB would be the first opened workbook then.

How to create 'Personal.XLSB' if you don't have it? Go to excel, start recording macro but before you press OK choose something like 'Personal Macro Workbook' on the second list. Do not forget to save it each time you leave Excel to keep all changes in your code.

Kazimierz Jawor
  • 18,861
  • 7
  • 35
  • 55
0

VBA doesn't have a similar feature, no.

You can export your classes and modules to standalone files, and import them into other VBA projects. And some apps, such as Microsoft Word, have features to share macros between documents, in the case of Word by attaching those macros to the Normal template. But there is no feature to reuse small snippets of code.

j__m
  • 9,392
  • 1
  • 32
  • 56
0

Have a look at MZTools ... there are versions for VB of various flavors, and for VBA. I'm not sure if it's suitable for handling huge numbers of code snippets but for smallish amounts it should be fine. It's free and has dozens of other hugely useful features.

Steve Rindsberg
  • 14,442
  • 1
  • 29
  • 34