ilearnexcelvba

iLearn Excel VBA: Cells and Ranges

By Peter Atoria  //  December 14th, 2011  //  Visual Basic  //  No Comments

Cells and Ranges . . . I’m lost already!

If you open up Excel you will see countless boxes. These boxes are called Cells. You can store many different kinds of variables within these cells including numbers, strings, and even dates. If you highlight a bunch of cells (click on a cell and while holding the left click down, drag your mouse to another cell), you just selected a Range of cells. The row numbers are on the left and the column numbers are denoted as letters across the top row. Now that definitions are out of the way, we can move on to cell manipulation. (more…)

ilearnexcelvba

iLearn Excel VBA: Select-Case

By Peter Atoria  //  December 14th, 2011  //  Excel, Visual Basic  //  No Comments

The Forgotten Select-Case

The Select-Case is often ignored when programming as it can be easily substituted with If-Then-Else statements. It functions much like a If-Then-Else statement and computes a conditional where if true, completes a segment of code. Let’s look at the example: (more…)

ilearnexcelvba

iLearn Excel VBA: Do-While-Loop

By Peter Atoria  //  September 7th, 2011  //  Visual Basic  //  No Comments

A Different Kind of Loop

A Do-While-Loop is similar to a For-Loop in the sense that they are both iteration statements. The only difference is that the Do-While-Loop has a conditional statement that it uses to determine whether or not the loop shall continue. Take a look: (more…)

ilearnexcelvba

iLearn Excel VBA: For-Loop

By Peter Atoria  //  August 28th, 2011  //  Visual Basic  //  No Comments

For-Loops Spin You Right Round

The For-Loop is an iteration statement. An iteration statement is one that repeats a segment of code until a desired result is achieved. Each repetition is called an iteration. Again, it’s easier to learn by example: (more…)

ilearnexcelvba

iLearn Excel VBA: If-Then-Else

By Peter Atoria  //  August 27th, 2011  //  Visual Basic  //  No Comments

The Almighty If-Then-Else

The If-Then-Else is a perfect example of a conditional statement. A conditional statement is a true/false statement that is computed to determine if a code segment should be executed. Let’s have a look at a practical example: (more…)

ilearnexcelvba

iLearn Excel VBA: Procedures and Data Types

By Peter Atoria  //  June 14th, 2011  //  Visual Basic  //  No Comments

Variables and Data Types

Variables are like boxes. You can change the contents of the box whenever you want and you can change the label of the box depending on what you want to put inside. Variables must not start with a number, must not have spaces, and must not contain symbols. For example, “Happy” is acceptable, “1Happy”, “Ha ppy”, and “Happy!” are all unacceptable variable names. Let’s make it easy and start with variable foo. Variable foo is undeclared at the moment, meaning he doesn’t know whether he is a string, integer, or other data type. First let’s see what foo can choose to be: (more…)

ilearnexcelvba

iLearn Excel VBA – Introduction

By Peter Atoria  //  June 10th, 2011  //  Visual Basic  //  No Comments

Why Do You Need It?

If you are reading this then you already found a reason why you want to learn Excel VBA. I will be using Microsoft Excel 2007 to demonstrate all the amazing things you can do. All versions of Microsoft Office have a Visual Basic Editor built right in, so you don’t need to buy anything extra. Note that, although you are learning Visual Basic through Excel, you could apply it to other applications that use Visual Basic as well.

Setting Up Your Workspace

Open up Excel 2007 and you will have an empty worksheet labeled Book1 or something along those lines. The first thing we want to do is get a developer tab. (more…)