which module to use

hitch_hiker

Active Member
Joined
Feb 21, 2012
Messages
294
One of my workbooks has become corrupted, I printed all the vba, and now I have to retype it all, do I need to put each back into the modules or can I just write each sub one after each other in one module?
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
You can put them all in the same Module if you want.

Your Module would look something like this:


Code:
Sub Hello()
MsgBox "Hello"
End Sub
Sub GoodBye()
MsgBox "GoodBye"
End Sub
Sub Dads_Home()
MsgBox "Lets all hide"
End Sub
 
Upvote 0
Making sure of course that any that are sheet related go into their respective sheets
AND
any that are workbook related, like Workbook_open, for instance are in the This Workbook Module
 
Upvote 0
There may also be issues with variable and procedure scope within and between modules. i.e. global vs module variables, Private vs Public, etc.
The safest approach is to replicate the original module structure and put the code exactly where it was before.
 
Upvote 0
You said:
I printed all the vba, and now I have to retype it all,

If you put all the code into A Word Document for example and then printed it out.

Just copy the code from the Word Document and paste it in the Module.

No need Retyping it.


 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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