VBA & Macro Problems

How to Use a Cell Address Stored in Another Cell with VBA

Steven ParkerSteven Parker Oct 23, 2026 871 views

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.

How to Use a Cell Address Stored in Another Cell with VBA
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.
Before you start

Ensure that your workbook is saved as a Macro-Enabled format (.xlsm) and that the Developer tab is enabled to access the VBA editor.

Solution 1Recommended

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.

1
Open the VBA Editor

Press Alt + F11 on your keyboard to launch the Visual Basic for Applications editor.

2
Insert a New Module

Click 'Insert' from the top menu bar and select 'Module' to create a blank script window.

3
Write the Dynamic Range Code

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

4
Assign Code to a Button

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.

Use Nested Range Objects for Dynamic Value Transfer
Syntax check: Make sure you use a period rather than a comma in the VBA syntax when calling properties, and double-check that the text in cell A1 represents a valid range reference.
Automate Data Transfers Easily

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. 1. Download and Install: Get WPS Office from the official website and open your macro-enabled spreadsheet.
  2. 2. Enable Developer Tools: Navigate to the Developer tab to access the built-in VBA Editor.
  3. 3. Run Your Macros: Write your dynamic nested range code and assign it to buttons for instant execution.
Fully compatible with Microsoft Excel VBA syntax and .xlsm formats.Advanced Developer Tools built-in for script writing and interface design.Lightweight application that runs macros smoothly without lag.Cost-effective with essential spreadsheet capabilities completely free.
microsoft office alternative - wps office

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.