Forum Discussion

Jon Cohen's avatar
Jon Cohen
Copper Contributor
May 21, 2021
Solved

Saving a cell's address in another cell & later going back to that cell

Let's say my cursor is in cell D123.  I want to create a macro that will jump to A300, save "D123" in A300, so some calculations, and then go back to cell D123.    My Visual Basic skills have atrop...
  • HansVogelaar's avatar
    HansVogelaar
    May 21, 2021

    Jon Cohen 

    No, Address is a read-only property: you cannot set it.

    You use the Select method of a cell to make it the active cell.

     

    You could do this:

     

     

        Dim CameFrom As Range
        Set CameFrom = ActiveCell
        ...
        <your calculations here>
        ...
        CameFrom.Select

     

     

    Note that CameFrom is a Range variable here, not a String variable.

Resources