How
to download & incorporate VBA code into Microsoft Excel
Download code:
Your browser
may be configured to automatically download the BAS module by simply clicking
on the link. However, if opens up the file & shows the listing,
then you must specifically instruct the browser to download the file, not
open it.
From
Internet Explorer:
-
Right click on the link & choose
"Save Target As...".
-
Choose the location & name to
save the file. I'd recommend keeping the same name. Pick a
subdirectory in which you will have the spreadsheet that makes use of this
code.
-
Click the "Save" button.
From
Mozilla:
-
Right click on the link & choose
"Save Link Target As...".
-
Choose the location & name to
save the file. I'd recommend keeping the same name. Pick a
subdirectory in which you will have the spreadsheet that makes use of this
code.
- Click
the "Save" button.
Incorporate
code into Microsoft Excel spreadsheet:
The easiest
way to incorporate the code is to import the module using the Visual Basic
editor.
-
Open up Microsoft Excel. Create
or open the spreadsheet to make use of the functions in the VBA module.
-
Open the Visual Basic Editor by clicking
on the menu items "Tools", "Macro", and "Visual Basic Editor".
-
You should be able to see the Project
window in the upper left hand side of the screen. If not, click on
the menu items "View" "Project Manager".
-
Right click on the VBAProject with
your file name. Select "Import File...". Go through the directory
structure in the Import File box until you find the Visual Basic file that
you want. Select the file name & press "Open".
-
You should now have a subfolder "Modules"
for your file. If you want to look at the code, press the "+" sign
for the Modules to expand the list & double click on the module of
interest.
-
The VBA code is ready for use.
Go back to the Excel spreadsheet. Select "Insert" "Function" (or
the "fx" button) to bring up the Paste Function dialog box. Select
"User Defined" towards the bottom of the "Function category" list on the
left. You should now have a list of functions in the "Function Name"
list on the right. Select the function you'd like to use & click
"OK". You will now have a dialog box for the specific function.