Browse » Home
Saturday, August 20, 2011
How to Find Row Number of Active Cell For VBA
1. Press 'Alt' and 'F11' together from inside the worksheet where you want to find the active cell's row number. This action opens the Visual Basic Editor (VBE).
2. Click 'Insert' and then click 'Module' to open a blank module window.
3. Cut and paste the following code into your worksheet:Sub RowNum()MsgBox 'The active cell row is ' ActiveCell.RowEnd Sub
4. Press 'F5' to run the routine. The macro will return the active cell's row in a message box.