Tutorial on Excel Macros (VBA)      

Excel VBA Consulting

VBA Excel help

Excel functions and formulas


Macros in Excel


Excel Macros Help


VBA for Excel Solutions



Programming in Excel


Macro Vocabulary in Excel


Forms (UserForms) in Excel


Moving around the Worksheet in VBA for Excel

Cells and Range in VBA for Excel

In Part 1 we will study theVBA word that you will use the most: Range.

Cells or Range

A lot of VBA beginners start their career using Cells. For example:
Cells(1,1).Select is the same thing as Range("A1").Select and
is the same as Range("AE11").Select.

I strongly recommend that you use Range instead of Cells to work with cells and groups of cells. It makes your sentences much clearer and you are not forced to remember that column AE is column 31.

The only time that you will use Cells is when you want to select all the cells of a worksheet like in:
To select all cells and then to empty all cells of values or formulas you will use:

See part 3 of lesson 2-6 to learn why you should never use Delete but ClearContents and all about Activecell, Selection and CurrentRegion


Note the ever present set of quotation marks in the following lines of code. You will be using the quotation marks with range, rows, columns, worksheets, workbooks and many other objects.

To select a single cell you will write:

To select a set of contiguous cells you will use the colon and write:

To select a set of non contiguous cells you will use the comma and write:

To select a set of non contiguous cells and a range you will use both the colon and the comma:

A special use of Range
To select a set of non contiguous columns you will not write:


To select a set of non contiguous rows you will not write:


BEWARE: You cannor write:
You  must first go to the sheet then select the range

For advanced users: Instead of using addresses like A1 or G27 with Range  you can use named fields, addresses that you have stored in other cells or variables to replace addresses or part of them like in the sentences below.
Range(myVariable).Select notice the absence of quotation marks
Range("A" & Range("B2").Value).Select
Range("A" & myVariable).Select

Range( myVariable & "12").Select

Range("A12:" & Range("B2").Value).Select
Range("A12:" & myVariable).Select
See part 5 of lesson 2-6 for examples.

Note: Remember that if your sentence reads:
and you insert a line above line 12 your macro doesn't work anymore because what was in cell C12 is now in cell C13..


To make the font bold or not:

Learn More
At your own pace
In the confort of your home and office


Excel VBA Consulting

Excel macros help

Exxcel functions and formulas