How to Use a Cell Address Stored in Another Cell with VBA
Question details
The user needs to use VBA to transfer a value from a source cell to a destination cell, where the destination's cell address is stored dynamically as text in a different cell.

- Product
- Spreadsheets
- Device & OS
- not provided
- Scenario
- Automating data transfer through a macro where a user inputs a target cell reference (like 'C20') into a specific control cell, and the script uses that text to perform the value assignment.
- Observed behavior
- The user requires the correct syntax to evaluate a text string as a valid Range argument to complete the value transfer without encountering syntax errors.
Ensure that your workbook is saved as a Macro-Enabled format (.xlsm) and that the Developer tab is enabled to access the VBA editor.
Use Nested Range Objects for Dynamic Value Transfer
You can use the text value of the address cell directly as the string argument for the destination Range object in VBA.
In VBA, the Range object expects a string indicating the cell address. Instead of hardcoding the address, you can pass another Range's Value property directly into it to make your macro dynamic.
Press Alt + F11 on your keyboard to launch the Visual Basic for Applications editor.
Click 'Insert' from the top menu bar and select 'Module' to create a blank script window.
Enter the nested Range code. If cell A1 contains the destination address (e.g., 'C20') and B10 contains the source value to transfer, type: Range(Range("A1").Value).Value = Range("B10").Value
To execute this script easily, insert a Form Control button on your worksheet, right-click it, select 'Assign Macro', and link it to your newly created procedure.

Store the Address String in a Variable
Assigning the dynamic cell address to a string variable first improves code readability, especially for complex macros involving multiple dynamic references.
Use WPS Spreadsheets for Powerful VBA and Macro Automation
WPS Office offers comprehensive support for VBA macros, enabling you to build, debug, and execute dynamic cell referencing scripts with exactly the same syntax you use in Microsoft Excel.
- 1. Download and Install: Get WPS Office from the official website and open your macro-enabled spreadsheet.
- 2. Enable Developer Tools: Navigate to the Developer tab to access the built-in VBA Editor.
- 3. Run Your Macros: Write your dynamic nested range code and assign it to buttons for instant execution.

Frequently Asked Questions
Why do I get a 'Method Range of object Global failed' error?
This runtime error occurs if the cell providing the text address (like A1) is blank or contains a string that isn't recognized as a valid cell reference (like 'Total' instead of 'D15'). Ensure the cell contains a valid coordinate format before triggering the macro.
How do I reference an address cell located on a different worksheet?
To reference a cell on a different sheet, you must explicitly qualify the Range object. For example: Worksheets("Sheet2").Range(Worksheets("Sheet1").Range("A1").Value).Value = 100.
Are nested Range methods fully compatible between Excel and WPS Spreadsheets?
Yes, standard VBA object syntax like Range(Range("A1").Value).Value operates identically in both Microsoft Excel and WPS Spreadsheets without needing any code modification.
Can I achieve this without VBA using formulas?
If you only want to read and display a value based on a cell address stored as text, you can use the built-in spreadsheet function =INDIRECT(A1). However, if you want to push/transfer a static value into that destination dynamically based on an event like a button click, VBA is required.




