VBA retrieve and current Row and Colum, in Excel

I wanted to store Row and Column in a VBA macro, and could not really find a good source for the how to anywhere so thought I would document how I did it:

  Dim actRow As Integer
  Dim actCol As Integer
  Dim actRange As String
  actRow = ActiveCell.Row
  actCol = ActiveCell.Column
  ' I actually want 2 rows up in the same colum.
  actRange = Chr$(Asc("A") + actCol) + CStr(actRow - 2)
  Range(actRange).Select


You can change the row and col by just adding 1.

Comments

Popular Posts