VBA & Macro Problems

Reference a Worksheet in Another Excel Instance with VBA

Ayan MasoodAyan Masood Nov 25, 2026 869 views

Question details

Access a specific worksheet in Update.xlsb from VBA running in Master.xlsb when the files are open in separate Excel instances.

Reference a Worksheet in Another Excel Instance with VBA
Product
Microsoft Excel VBA
Device & OS
not provided
Scenario
A macro creates a separate Excel application and opens Update.xlsb while Master.xlsb remains in the original instance.
Observed behavior
The macro cannot reliably reference the target workbook or worksheet in the separate Excel instance.
Before you start

Confirm the full path to Update.xlsb and the exact name of its target worksheet. The example assumes the macro is stored in Master.xlsb and that both workbooks have a worksheet named Report.

Solution 1Recommended

Store explicit references to the Excel application, workbook, and worksheet

Use the objects returned when you create the second Excel instance and open its workbook, rather than relying on the active workbook.

Each Excel instance has its own workbooks collection. Explicit references keep the macro connected to the intended workbook and worksheet in each instance.

1
Open the VBA editor

In Master.xlsb, open the Visual Basic Editor and select the module containing your macro.

2
Create and retain object references

Adapt this example with the actual path and sheet names: Sub ReadUpdateSheet() Dim xlApp As Excel.Application Dim updateWb As Excel.Workbook Dim updateWs As Excel.Worksheet Dim masterWs As Excel.Worksheet Set masterWs = ThisWorkbook.Worksheets("Report") Set xlApp = CreateObject("Excel.Application") Set updateWb = xlApp.Workbooks.Open("C:\Path\Update.xlsb", ReadOnly:=True) Set updateWs = updateWb.Worksheets("Report") masterWs.Range("A1").Value = updateWs.Range("A1").Value updateWb.Close SaveChanges:=False xlApp.Quit Set updateWs = Nothing Set updateWb = Nothing Set xlApp = Nothing Set masterWs = Nothing End Sub

3
Run and check the macro

Run the macro from the VBA editor and check cell A1 on the Report sheet in Master.xlsb. Replace the example cell references with the data you need.

Store explicit references to the Excel application, workbook, and worksheet
Clean up on errors: The example closes the read-only update workbook and the instance it created when it completes normally. Add error handling to close them if an operation fails. ThisWorkbook refers to the workbook containing the code; use an explicit Master.xlsb reference if the code is stored elsewhere.
Free Microsoft Office alternative

Work with spreadsheets in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for opening and editing spreadsheets. It supports common Excel formats for easier migration, but it does not fix Excel's cross-instance VBA references; verify workbook and macro compatibility before switching.

Open and edit spreadsheets in a familiar interfaceCompatible with common Microsoft Excel formats, including XLSX and XLSMReview spreadsheet data without relying on a cross-instance Excel VBA macroFree and lightweight for everyday office tasks
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't ActiveWorkbook reliably identify Update.xlsb?

ActiveWorkbook depends on the active workbook in an Excel instance. Save the result of xlApp.Workbooks.Open in a variable such as updateWb, then use updateWb.Worksheets("Report").

How do I reference the workbook containing the macro?

Use ThisWorkbook in the VBA module to refer to the workbook containing the code. For example, ThisWorkbook.Worksheets("Report") selects its Report sheet.

Can I transfer a cell value between the two instances?

Yes. Once you have worksheet references in both instances, assign a value directly, for example: masterWs.Range("A1").Value = updateWs.Range("A1").Value.

How do I prevent the second Excel instance from remaining open?

Close the workbook with updateWb.Close and call xlApp.Quit when you are finished. Add an error-handling cleanup section so these actions also run if the macro fails.