Excel VBA to select the first cell in a range

Top left cell

If you need to refer to the first cell (top, left cell) in a range there is an easy way to do it.

Let’s say you only want to change a single cell, the first cell in the selected range.

Maybe the user is only supposed to select a single cell, so you will only change one cell.

Even if the user has selected a large range you only want to handle the first cell in the top left corner of the range.

To refer to the first cell in the selected range you can use the statement.

Selection(1)

That’s it – easy.

If you want to make it bold use

Selection (1).Font.Bold = True

This assumes that the user has selected a range, so you might want to read my next post which handles identifying ranges.

Please note: I reserve the right to delete comments that are offensive or off-topic.

Leave a Reply to Neale Blackwood Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

3 thoughts on “Excel VBA to select the first cell in a range

  1. I prefer to use

    Selection.Cells(1)

    which means the first cell in the selection, or

    Selection.Cells(1, 1)

    which means the cell in the first row and first column of the selection.

    They do the same thing, and Cells is already the default property of a range, but Cells makes the code self-documenting.

  2. Where “In a Range”
    You’re selecting and I don’t need to select anything.
    Example: Set myRange = Range(“B7:B11”)

    • The post was about a range selected before the macro was run, which is always called Selection.

      If you have used a variable to define a range you could use myRange(1) to refer to the first cell in the range.