How to Fix Excel VBA Runtime Error 1004 After Moving a Workbook
Question details
The user needs to fix VBA Runtime Error 1004 that occurs when running a macro after transferring an Excel workbook to another computer.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Running a specific macro (CalculateResults) after transferring a macro-enabled workbook from a desktop running Excel 2021 to a laptop running Excel 2016.
- Observed behavior
- The macro executes properly in Excel 2021 but throws a Runtime Error 1004 (application-defined or object-defined error) in Excel 2016.
Before modifying your VBA scripts, save a backup copy of your macro-enabled workbook (.xlsm) to prevent any accidental loss of functional code.
Replace Select and ActiveCell with Direct Object References
Avoid using Select, Selection, and ActiveCell commands, which frequently cause Error 1004 across different Excel versions, by referencing objects directly.
When a workbook is moved between Excel versions (like 2021 to 2016), implicitly referencing active sheets or cells can trigger application-defined errors if the focus shifts unexpectedly. Explicitly defining your workbooks, worksheets, and ranges ensures the macro always targets the exact location regardless of what is currently selected on screen.
Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.
In the Project Explorer pane on the left, double-click the module containing your CalculateResults macro to view the code.
Scan your code for lines that use '.Select', 'Selection', or 'ActiveCell'. For example, look for patterns like 'Worksheets("Sheet1").Select' followed by 'Range("A1").Select'.
Combine the lines to reference the object directly. Change 'Range("A1").Select' and 'Selection.Copy' into a single statement like 'Worksheets("Sheet1").Range("A1").Copy'.
Save your changes, close the VBA editor, and run the macro in Excel 2016 to verify that Runtime Error 1004 is resolved.

Check for Version-Specific Features or Formulas
Ensure the workbook does not rely on functions or features exclusive to Excel 2021 that are unsupported in Excel 2016.
Try WPS Office for Seamless Spreadsheet Management
If you frequently encounter version compatibility issues or runtime errors when transferring files between different Microsoft Office versions, consider switching to WPS Office. It provides a highly compatible spreadsheet environment that handles complex data effortlessly.
- 1. Download WPS Office: Visit the official WPS Office website to download and install the free software on your computer.
- 2. Open WPS Spreadsheet: Launch the WPS Office suite and click on the 'Spreadsheet' module.
- 3. Load your file: Click 'Menu' > 'Open' to import your existing Excel files and start managing your data seamlessly.

Frequently Asked Questions
What does VBA Runtime Error 1004 mean?
Runtime Error 1004 is a generic error in Excel VBA that typically means 'Application-defined or object-defined error.' It usually occurs when your code attempts to reference an object, like a worksheet or cell range, that doesn't exist, is misspelled, or isn't currently active when using implicit references.
Why does my macro work in Excel 2021 but fail in Excel 2016?
Newer versions of Excel introduce new functions, dynamic arrays, and background behaviors that might not be supported in Excel 2016. Furthermore, differences in how the VBA engine handles active windows or unreferenced objects can cause macros to fail on older desktop environments.
How do I share a sanitized workbook for troubleshooting?
A sanitized workbook is a copy of your file with all sensitive or confidential information removed or replaced with dummy data. Save this copy, upload it to a reliable cloud service like Dropbox or Google Drive, and generate a shareable link to provide to support forums for secure troubleshooting.




