Add a Set statement to link your variable to a real object (e.g., Set mySheet = Sheets("Sheet1") ).
If the error occurs in Microsoft Office, try updating or repairing the installation to fix potential file corruption. Step-by-Step Troubleshooting 1. Identify the Broken Line How to Fix Runtime Error 91 in a Safe and Easy Way
In Visual Basic, standard variables (like numbers or text) use simple = signs, but (like Worksheets, Ranges, or Documents) require the Set keyword. Wrong: myRange = Range("A1") Right: Set myRange = Range("A1") 3. Check for Successful Finds VBA: Run time error '91'? - Stack Overflow Add a Set statement to link your variable