Introduction to Programming Macros in Excel
First Steps
Getting and Inputting Data
Adding Logic to Macros
UDF- User Defined Functions
Speeding Up Macros

Select Cells in Excel using Macros and VBA

Add to Favorites
Author: don

This is actually a very easy thing to do and only requires a couple lines of code. Below I will show you how to select a cell or a range of cells on the currently active or visible worksheet in Excel.

The simplest way to this is with a macro like this:

Sub Select_Cells_in_Excel()

'Select a single cell in the current worksheet

Cells(4, 3).Select

End Sub

Copy and paste this into your Excel workbook and read the comments, which will appear in green, to follow everything.

The basic way to select a cell in the currently active worksheet in Excel is to use this method:


This is pretty simple to understand.  All you have to do is to change A1 to whichever cell you want to be selected.  Thats it!

I prefer to use the range method since it is the simplest way to select a cell.  When you create more advanced macros in VBA you may need to use the Cells method.


This sample is in the macro above and it points you to cell C4.  The first number is the row of the cell to select, 4, and the second number is the column, 3.  To get the column number you just count from 1, which is the letter A down to the letter column you wish to reference.  A =1, B=2,C=3, etc.

So, you can see that it is actually very easy to select a cell in Excel using macros and VBA.  If I were you, I would stick to using the Range method of doing this just because it is so much easier to tell which cell is being referenced just by looking at the code in question.

Question? Ask it in our Excel Forum