How to Select Range from Active Cell Using VBA in Excel: 3 Effective Methods

Method 1 – Employing VBA to Select Range from Active Cell to the Last Non-Blank Cell

Steps:

  • From the Developer tab >>> select Visual Basic.

The Visual Basic window will appear.

  • From Insert >>> select Module.

This will bring up the Module window.

excel vba select range from active cell


1.1. Using the End(xlUp) Property

Steps:

Sub ToUp()
Range(ActiveCell, ActiveCell.End(xlUp)).Select
End Sub

We’re calling our Sub Procedure ToUp. Then we’re selecting our range. The first value is our active cell. The last value is ActiveCell.End(xlUp). We’re selecting the range with the Range.Select method.

  • Save it and close the window.
  • Select cell C6. This cell is our active cell.

excel vba select range from active cell

Bring up the Macro window. To do that-

  • From the Developer tab >>> select Macros.

The Macro dialog box will appear.

  • Select “ToUp” from the “Macro name:”.
  • Click on Run.

excel vba select range from active cell

We can see that we’ve selected the cell range C4:C6.


1.2. Incorporating the End(xlDown) Property

Steps:

Sub ToDown()
Range(ActiveCell, ActiveCell.End(xlDown)).Select
End Sub

We’re calling our Sub Procedure ToDown and selecting our range. The first value is our active cell. The last value is ActiveCell.End(xlDown). We’re selecting the range with the Range.Select method.

excel vba select range from active cell

  • Save it and close the window.
  • Select cell C6. This is our active cell.

excel vba select range from active cell

We selected a range from our active cell using Excel VBA.


1.3. Applying the End(xlToLeft) Property

Steps:

Sub ToLeft()
Range(ActiveCell, ActiveCell.End(xlToLeft)).Select
End Sub

We’re calling our Sub Procedure ToLeft. Then we’re selecting our range. The first value is our active cell. The last value is ActiveCell.End(xlToLeft). We’re selecting the range with the Range.Select method.

excel vba select range from active cell

  • Save it and close the window.
  • Select cell D7. This is our active cell.

excel vba select range from active cell

We selected a range from our active cell using Excel VBA.


1.4. Implementing the End(xlToRight) Property

Steps:

Sub ToLeft()
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
End Sub

We’re calling our Sub Procedure ToRight. Then we’re selecting our range. The first value is our active cell. The last value is ActiveCell.End(xlToRight). We’re selecting the range with the Range.Select method.

excel vba select range from active cell

  • Save it and close the window.
  • Select cell C8. This is our active cell.

excel vba select range from active cell

We selected a range from our active cell using Excel VBA.


Method 2 – Using the VBA Range.Offset Property to Select Range from Active Cell Using VBA in Excel

Steps:

Sub UsingOffset()
Range(ActiveCell, ActiveCell.Offset(1, 2)).Select
End Sub

We’ve created our Sub Procedure  UsingOffset. Then we’re selecting our range. The first value is our active cell. The last value is ActiveCell.Offset(1,2). With the Offset property we’re moving 1 row down and 2 columns right. We’re selecting the range with the Range.Select method.

excel vba select range from active cell

  • Save it and close the window.
  • Select cell B8. This is our active cell.

excel vba select range from active cell

We selected a range from the active cell. This is what the final step should look like.


Method 3 – Select Range from Active Cell Using VBA in Excel by Utilizing the CurrentRegion Property

Steps:

Sub cRegion()
ActiveCell.CurrentRegion.Select
End Sub

We’re calling our Sub Procedure cRegion. Then we select our range. With the CurrentRegion property, we select the range up to a blank cell. We’re selecting the range with the Range.Select method.

excel vba select range from active cell

  • Save it and go back to the Excel sheet.
  • Select cell C10. This is our active cell.

excel vba select range from active cell

We selected the range up to a blank cell.


Download Practice Workbook


Related Articles

Get FREE Advanced Excel Exercises with Solutions!
Rafiul Haq
Rafiul Haq

Rafiul Haq worked as an Excel and VBA Content Developer in Exceldemy for over two years and published almost 200 articles for the website. He is passionate about exploring new aspects of Excel and VBA. He received his Bachelor of Science in Mechanical and Production Engineering (MPE) from the Islamic University of Technology. Rafiul furthered his education by obtaining an MBA in Finance from the Institute of Business Administration (IBA) at the University of Dhaka. Apart from creating... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo