Selecting Cells using Excel VBA Macros - Absolute
Part three of a four-part series of blogs

This blog gives the various possible ways to select cells, ranges, columns and rows using Visual Basic for Applications in Excel. Useful for the VBA newbie, but even gurus might find one or two commands they'd missed!

  1. Selecting Cells in Excel Visual Basic Macros (Absolute)
  2. Absolute Selection - the Common Excel VBA Commands
  3. Selecting Rows, Columns and Entire Worksheets (this blog)
  4. Less Common Absolute Selection Commands

This blog is part of our Excel macros online tutorial series.  For real-world training, book onto our introductory or advanced VBA or Excel courses.

Posted by Andy Brown on 11 August 2011

You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Selecting Rows, Columns and Entire Worksheets

Sometimes you'll want to select entire rows or columns, or even every cell in a worksheet.  Here's how:

Selecting Columns

You can do this using the Columns collection.  For example:

Sub SelectColumns()

'select one column


'select several columns


End Sub

The above macro would select column B, then columns B through to D:

Columns B to D selected

The result of running the above macro.


Note that you can select a single column by number too - for example, Columns(2).Select - but this method doesn't work for a range of columns.


Selecting Rows

You can select rows in the same way, but using the Rows collection:

Sub SelectRows()

'select one row


'select several rows


End Sub

The above routine would leave rows 2 through to 4 selected:

Rows 2 to 4 selected

The results of running the macro above.


Note that as for columns you can dispense with the quotation marks if you're selecting a single row.  So Rows(2).Select would also select the second row.

 Selecting Every Cell in a Worksheet

In Excel you can select every single cell by clicking on the square at the top left corner of a worksheet:

Selecting every cell

Click on the square shown to select every cell in a worksheet.


The VBA equivalent command to select every single cell in a sheet is:

'select every cell in a worksheet


Having seen how to select cells, rows and columns, it's time to complete the picture by showing some of the less commonly used selection commands. 

This blog has 0 threads Add post