A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Dear @Juma, Nafisa,
Good day! Welcome to Microsoft Q&A forum!
Based on your description, I understand that you’re encountering a Microsoft Visual Basic Run‑time error ‘1004’ when trying to generate a report. The error message indicates “Method ‘Range’ of object ‘_Worksheet’ failed,” as shown in the screenshot. You’re looking for help understanding what this error means and how to fix it.\
This usually means Excel is having trouble locating or referencing a specific cell range in the code.
In the meantime, kindly try the following suggestions to check what might have caused the issue:
- Check the worksheet name: Make sure the worksheet name being used in the macro hasn’t been changed or misspelled. Even small differences (like an extra space) can cause this error.
- Verify the referenced range exists: The macro may be pointing to a range that no longer exists (for example, a column or row that was deleted). Try opening the code and checking the range reference can help identify this.
- Unprotect the sheet (if applicable): If the worksheet is protected, some macros can’t access the range. Try temporarily unprotecting the sheet and running the report again.
- Check for hidden rows/columns: Sometimes, if the macro expects data in a specific location but that row/column is hidden or filtered out, it can trigger this error.
- Try running the macro on a fresh copy of the file: If the file may be corrupted, opening a clean or backup version often resolves the issue.
To help me pinpoint the root cause more quickly, could you share whether the report was working before, or if anything in the file has changed recently, such as sheet names, formatting, or data ranges?
Your confirmation would be very helpful in ensuring you receive the most suitable support!
Kindly let me know when there are updates or if you need further assistance. Any updates you’re able to share would be really helpful. I appreciate your time and look forward to hearing how things are going!
Thank you for your time and patience.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in [our documentation] to enable e-mail notifications if you want to receive the related email notification for this thread.