Ok, I confess, I have no idea how to use VB code!

Mhowells

New Member
Joined
Aug 24, 2006
Messages
29
Dear all,

Alright, I have to confess it. I have no idea how to add VB script to a workbook. Everyone talks about it as if it’s a given, but I can’t make heads not tails of the help files on this site.

I have been given a slab of code with the instruction that running it will potentially shrink the size of the workbook file. I have opened up the editor, inserted the aforementioned code into the workbook script window (or what I assume is the workbook script window) and the only change I have noticed is that the file has become larger.

Can anyone either A.) explain what I am doing wrong and tell me how to get this thing to work or B.) point me towards a help site that explains the process in fairly simple terms.

Best,
Max
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

patrickmuldoon99

Active Member
Joined
Jun 27, 2006
Messages
345
Press Alt F11, then goto Insert--> Module within the VBA window.

Paste any code that you have been given - it should begin with 'Sub' and end with End Sub. The Sub will have the name of the macro written after it, eg: Sub MyMacro

Once you have got the code in there, close down the VBA window.

Then in excel goto Tools --> Macros --> and select the name from the box that appears that matches the name of your Sub.

Clicking Run will then execute the macro, and you should see the results afterwards in terms of reduction of size of your workbook.

Hope this helps, feel free to post if this is not clear.
 

Forum statistics

Threads
1,136,926
Messages
5,678,616
Members
419,776
Latest member
mikelowski

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
Top