Forum Discussion
Saving a cell's address in another cell & later going back to that cell
- May 21, 2021
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.SelectNote that CameFrom is a Range variable here, not a String variable.
You don't really have to jump to A300 to store a cell address there. In fact, you rarely need to select a call or range in a macro. It is perfectly possible to perform calculations and manipulate cells without selecting them. And you could also store the cell that is active when you start the macro (or its address) in a variable.
If you still need to store the address of the active cell in A300:
Range("A300").Value = ActiveCell.AddressCameFrom = ActiveCell.Address
< do my calculations, then >
ActiveCell.Address = CameFrom
?
- HansVogelaarMay 21, 2021MVP
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.SelectNote that CameFrom is a Range variable here, not a String variable.