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
For the cell’s column:
Sub ActiveCellColumn() MsgBox ActiveCell.Column End Sub
Active Cell Row
For the cell’s row:
Sub ActiveCellRow() MsgBox ActiveCell.Row End Sub
Enter your email address to subscribe to this blog and receive notifications of new posts by email.