Where to place VBA coding?

EssKayKay

Board Regular
Joined
Jan 5, 2003
Messages
233
Office Version
  1. 2007
Platform
  1. Windows
I have a question about location of VBA coding. The coding for my worksheet lies in two places, Sheet 1 and Module 1 (can’t answer why that happened). Should I or can I move all coding into one location (i.e. Module 1)?

Currently all routines are working fine so maybe “If it works don’t fix it” applies here. Your thoughts. . .
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
A good rule of thumb is that you should put any event procedure code in the appropriate underlying module (the "Sheet" and "ThisWorkbook" modules). Note the "event procedure" code is VBA code that runs automatically, like "Worksheet_Change").

Then any procedure/function that you create and run manually (by button or going through the Macros menu) should be placed in a General module that you manually create.
That will ensure that it is available from anywhere in your workbook.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,092
Messages
6,123,063
Members
449,090
Latest member
fragment

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top