Excel VBA Range Property

Basic Description

Quite a lot of the macros you’ll write will need to reference the Range property. But what is a Range? A Range just means a range of cells on a worksheet. A Range can be an individual cell, or a group of cells. The Range you want to refer to goes between round brackets. Inside the round brackets you surround your Range of cells with double quotes. Here’s a Range object that just refers to the cell A1: Range(“A1”)

And here’s a Range property that refers to a group of cells: Range(“A1:B7”)

Notice the semicolon separating the two cell references, and no spaces between the two. The first cell reference is the top left cell, while the second cell reference is the bottom right cell in your selection – a square, in other words. Another way to refer to more than one cell is to separate the two cell references with a comma. Each cell is then surrounded with double quotes. Like this: Range(“A1”, “B7”). This Range property refers to the cells A1 to B7.
Once you have a Range you can do something with it. One method you can use with Ranges is the Select method. As its name suggest, the method Selects a Range of cells:



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



clearPost Comment