Forum Discussion
VBA code that moves to a variable address that is contained in an ADDRESS formula
- Jun 08, 2023
To move the cursor to the address contained in cell C1, you can use the Range object in VBA. Since the value in cell C1 changes dynamically, you need to read the value from cell C1 each time the VBA code is executed.
Here is an example VBA code that moves the cursor to the address in cell C1:Sub MoveToAddress() Dim address As String address = Range("C1").Value ' Read the address from cell C1 Range(address).Select ' Move to the address End Sub
In this code, the Range("C1").Value statement retrieves the value (address) from cell C1, and then the Range(address).Select statement selects that range, effectively moving the cursor to that address.
You can run the MoveToAddress macro each time you want to move the cursor to the updated address in cell C1.
To move the cursor to the address contained in cell C1, you can use the Range object in VBA. Since the value in cell C1 changes dynamically, you need to read the value from cell C1 each time the VBA code is executed.
Here is an example VBA code that moves the cursor to the address in cell C1:
Sub MoveToAddress()
Dim address As String
address = Range("C1").Value ' Read the address from cell C1
Range(address).Select ' Move to the address
End Sub
In this code, the Range("C1").Value statement retrieves the value (address) from cell C1, and then the Range(address).Select statement selects that range, effectively moving the cursor to that address.
You can run the MoveToAddress macro each time you want to move the cursor to the updated address in cell C1.
- AE7888Jun 08, 2023Copper Contributor
- NikolinoDEJun 08, 2023Platinum ContributorI'm glad that they were helped.
I wish you continued success with Excel!