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?