Excel VBA Tutorial 1

The main thing to remember when you are trying to figure out how to write a program is to think logically, and draw the flow of events on paper. Your goal is to take your thought process and translate it to Excel VBA code.

Each video in the Excel VBA tutorial will highlight one of VBA’s many benefits, which are:

– automating frequently used actions.
– eliminating repetitive keystokes in muliple areas of your worksheet.
– making a series of commands process as a unit by “replaying” those commands.
– use the features of Excel VBA to generate custome buttons, user forms, and menus.
– ability to generate custom applications in Excel containing the procedures and tools you have generated.

Here are some important definitions:

Macro – A set of instructions to tell Excel to carry out.
Procedure – A set of sub procedure or function VBA statements functioning as a unit.
Sub Procedure – A sub routine (set of statements), which are part of a bigger module.
Function Procedure – A set of statements working together to return a value.
Code – VBA statements which are necessary to accomplish tasks.
Statement – VBA code containing variables, arguments, and operators.
Object – Items like a worksheet or range, you can control in your VBA code.
Method – An action an object can perform like copying, pasting, or calculating, etc.
Property – Things that describe an object like color and size.
Modules – A collection of sub procedures. These can be worksheet specific, or workbook specific.

Running Macros

Here is an image of what a blank macro box looks like:

select cell macro 1

When you add a sub procedure to your worksheet, the box won’t appear blank anymore:

select cell macro 2

Trick: An easy way to learn how to program with Excel VBA is to use the record utility in Excel, and then analyze the VBA code steps used to record the macro.

Here is the code stored in “Module1” produced by the macro recorder:

Let me know if you have any questions

I consent to having this website store my submitted information so they can respond to my inquiry. See our privacy policy to learn more how we use data.

Please remember to subscribe to my youtube channel

Been helped? Get these!