Excel Guides

Relative VBA Selections in Excel

There are a few different ways to select cells and ranges in VBA. The most common way is to use the Range object, which allows you to specify a cell or range of cells by address. For example, the following code would select cells A1:A10 on Sheet1:

Sheet1.Range("A1:A10").Select

You can also use the Cells property to select cells and ranges. The Cells property takes an index argument that can be either a number or a range of numbers. For example, the following code would select cell A1 on Sheet1:

Sheet1.Cells(1).Select

You can also use the Rows and Columns properties to select entire rows or columns. The following code would select column A on Sheet1:

Sheet1.Columns("A").Select

Move beyond 

Excel

Get started with Causal today.
Build models effortlessly, connect them directly to your data, and share them with interactive dashboards and beautiful visuals.