Table of Contents
Many times, we have required to find the row or column number of the active cells. In this blog, we will talk about how to find the VBA Active Cell.
1. Find Row number of the active cells.
This code will show the active row number in a message box.
Sub KDataScience_RowNumberOfActivecell() MsgBox ActiveCell.Row End Sub
2. (a) Find the column number of the active cells.
This code will show an active column number in a message box
Sub KDataScience_ColumnNumberOfActivecell() MsgBox ActiveCell.Column End Sub
2. (b) Find the column Name of the active cell.
This code will return the column name of the active cell.
Sub KDataScience_ColumnNameOfActivecell() Dim addr As String Dim ColName As String 'To Find the address of the active cell addr = ActiveCell.address 'To split the address by $ and take first element of addr ColName = VBA.Split(addr, "$")(1) End Sub
If you want to get (VBA active cell) column number or row number of the active cells of a worksheet then you can use any code shown above (according to one’s need).