How to Get Active Cell Column and Row in Excel VBA?

In this post, you’ll be learning how you can get the active cell column and row in Excel spreadsheet using Excel VBA.

How to Get the Active Cell Column in Excel VBA?

To get the active cell’s column or row from VBA, use this code:

To run the VBA code, you will be need to perform the below steps first.

  • Under the Developer tab, click on Visual Basics
  • In the Insert menu on the ribbon, click on the module options.
  • Enter the code in it, save the code and run it.

Get the Active Cell Column

Code

For the cell’s column:

Sub ActiveCellColumn()
MsgBox ActiveCell.Column
End Sub
How to Get Active Cell Column and Row in Excel VBA?

Active Cell Row

For the cell’s row:

Sub ActiveCellRow()
MsgBox ActiveCell.Row
End Sub
How to Get Active Cell Column and Row in Excel VBA?

Leave A Reply

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

You May Also Like

In this post, you’ll learn how to Find Blank cells in excel so that you can remove or delete the blank cells form...
In this article, you’ll learn what is a Gauge Chart in Microsoft Excel. Also, you will learn how to add...
Microsoft Excel provides a shortcut for the users to move columns in excel using two different ways – using Shift...