30 Advanced Excel Tips for 2026

Excel Champs / VBA / How to SELECT ALL the Cells in a Worksheet using a VBA Code
By Puneet Gogia (Microsoft MVP)

How to SELECT ALL the Cells in a Worksheet using a VBA Code

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

Use Cells.Select to select every cell on the active sheet, the same as clicking the corner box above row 1:

Cells.Select

A sheet has to be active before you can select on it. To select all the cells on another sheet, use Application.Goto, which switches to that sheet first: Application.Goto ThisWorkbook.Worksheets("Data").Cells. Calling Worksheets("Data").Cells.Select while another sheet is active stops with error 1004.

To select only the part of the sheet that holds data, use ActiveSheet.UsedRange.Select. For the block of data around the active cell, which is what Ctrl + A picks on its first press inside a table, use ActiveCell.CurrentRegion.Select.

Most code does not need to select anything. Act on the range directly, which is faster and works on any sheet without activating it:

With ThisWorkbook.Worksheets("Data").Cells
    .Font.Name = "Calibri"
    .Font.Size = 11
End With

UsedRange can be bigger than your data. It still counts cells that once held values or formatting, so it may include empty rows at the bottom. Delete the unused rows and columns and save the file to reset it.

[thrive_leads id=’70897′]

In VBA, there is a property called CELLS that you can use to select all the cells that you have in a worksheet.

Cells.Select

VBA to Select All the Cells

  1. First, type the CELLS property to refer to all the cells in the worksheet.
    type-the-cells-property
  2. After that, enter a (.) dot.
  3. At this point, you’ll have a list of methods and properties.
    enter-a-dot
  4. From that list select “Select” or type “Select”.
    from-list-select-select-or-type-select

Once you select the entire worksheet you can change the font, clear contents from it, or do other things.

Notes

  • The CELLS property works just like the way you use the keyboard shortcut Control + A to select all the cells.
  • When you run this VBA code, it will select all the cells even if the sheet is protected and some of the cells are locked.
  • It will select cells that are hidden as well.

The sheet Must Be Activated

Now you need to understand one thing here when you select all the cells from a sheet that sheet needs to be activated. In short, you can’t select cells from a sheet that is not activated.

Let’s say you want to select all the cells from “Sheet1”. If you use the type below code, you’ll get an error. You need to activate the “Sheet1” first and then use the “Cells” property to select all the cells.

Worksheets("Sheet1").Activate
Cells.Select

Now when you run this it will first activate the “Sheet1” and then select all the cells. This thing gives you a little limitation that you can’t select the entire sheet if that sheet is not activated.

Here’s another thing that you can do: You can add a new sheet and then select all the cells.

Sheets.Add.Name = "mySheet"
Cells.Select
Puneet Gogia

Written by

Puneet Gogia

Microsoft MVP — Excel · Founder, Excel Champs

Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.

3M+ readers helped
1,000+ tutorials written
Since 2015 teaching Excel