Skip to content

How to fix Excel error: Object variable or with block not set?

  • by
  • 4 min read

Excel is one of the most popular spreadsheet management programs on the planet. That said, its advanced features also make it rather complicated to use, especially for beginners. Things like Excel formulas and VBAs can actually be quite a headache to troubleshoot if you don’t know where to look. 

In this article, we’re going over the “object variable or with block not set” error in Excel, its causes and what you can do to fix the problem.


What causes this error?

There are several reasons why you might see this error. Common causes include:

  • Excel was installed without admin rights. 
  • Conflicting plugins.
  • Corrupt Excel installation. 
  • Variable or object hasn’t been defined correctly.

Also read: Iferror Excel guide: Everything you need to know


How to fix this?

Here are five fixes you can try out. 

Restart Excel

One quick thing you should try out before you get started with any technical troubleshooting is to restart Excel. This refreshes all configurations, data sets and formulas that might be outdated and could cause problems.


Check and disable faulty add-ins

Add-ins can make life easy when working with Excel. However, sometimes they conflict with the program’s functionality. Try disabling some add-ins to see if that gets Excel working properly. 

Step 1: Open Excel and click on the File tab at the top.

Step 2: Click on More followed by Options.

Step 3: Click the Add-ins option in the left side menu. then click on the Manage dropdown at the bottom.

Step 4: Select Excel Add-ins or COM Add-ins and then click the Go button.

Step 5: In the Add-ins box, uncheck all the add-ins to disable them. Now re-enable them one at a time to see if Excel starts working properly. This will help you single out the faulty add-in.

Also read: Fix: An existing connection was forcibly closed by the remote host


Update Office

Manually updating your Office Suite is also a good idea. That’ll help you get over any stuck or incomplete updates that might’ve been causing the issue. 


Check your functions

If you’re using any built-in Excel functions (or methods), check to see if they’re being implemented properly. These functions often deal with objects and variables which means that any mistake from declaring a variable to the incorrect use of an object can trigger the error. 


Reinstall Office

Reinstalling a program removes any corrupted files that may have been causing issues. 

Step 1: Press the Windows key and search for any Office program. Then, click on Uninstall from the right side pane.

How to fix the 'Outlook Cannot Expand folder' error?

Step 2: Find the Office installation, click it and click the Uninstall button.

How to fix the 'Outlook Cannot Expand folder' error?

Once the uninstallation is complete, install the suite again, and it should work just fine. 

Also read: How to delete a sheet in Excel? 

Yadullah Abidi

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here: yadullahabidi@pm.me.

>