HomeMicrosoft OfficeExcelHow to Get Active Cell Column and Row in Excel VBA?

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 article, you will learn about the SKEW.P function, the formula syntax and usage of the function in Microsoft...
In this article, you will learn about the SKEW function, the formula syntax and usage of the function in Microsoft...
In this article, you will learn about the RANK.EQ function, the formula syntax and usage of the function in Microsoft...
  • Excel
  • November 23, 2021