While using Microsoft Visual Basic for Applications on Excel, if you get Run-time error, Class not registered, here is how you can fix the issue. It is pretty common when there are some issues with the code or Office installation. That is why you can follow these tips and tricks to get rid of this problem.
You can run various codes via Visual Basic on an Excel spreadsheet to get different things done within moments and in automation. However, while running such a code, if you get the aforementioned error, you won’t be able to do what you were looking forward to. If so, you can follow the subsequent solutions to get rid of the error, as mentioned above.
Fix VBA Run-time error Class not registered in Excel
To fix Microsoft Visual Basic Run-time error Class not registered in Excel, follow these steps:
- Check the code
- Update Excel/Office
- Turn on trust access to VBA
- Repair Microsoft Office
To learn more about these steps, continue reading.
1] Check the code
It is the very first thing you need to check when you are getting the aforementioned error in Excel. If the entered or written code is wrong, the argument is missing, etc., you won’t be able to run it on your spreadsheet. As a result, you might get the error as said above. That is why it is recommended to verify the code before running it again or heading to other solutions.
Read: How to create Custom Excel Functions using VBA
2] Update Excel/Office
If you haven’t updated Excel or Office for a very long time, it is recommended to do that. At times, Microsoft might change various things, and that could be a reason why you are getting such an error. To update Office, do the following:
- Open Excel on your computer.
- Click on the Account.
- Expand the Update Options.
- Click the Update Now option.
Then, it will search for a pending update and install it accordingly.
3] Turn on Trust access to VBA
When you are getting this error, you must check if this setting is turned on or not. If not, it is suggested to enable it on your computer. To turn on trust access to the VBA project, follow these steps:
- Open Excel and click on Options.
- Switch to the Trust Center tab.
- Click the Trust Center Settings button.
- Go to the Macro Settings tab.
- Tick the Trust access to the VBA project object model checkbox.
- Click the OK button.
Then, restart Excel and check if the problem remains or not.
4] Repair Microsoft Office
It is the last thing you need to do in order to troubleshoot the error. To repair Office on Windows 11/10, do the following:
- Press Win+I to open Windows Settings.
- Go to Apps > Apps & features.
- Click the three-dotted button of Microsoft 365.
- Select the Modify option.
- Click the Yes button in the UAC prompt.
- Choose the Online Repair option.
- Click the Repair button.
Once the process is done, you can restart your computer and check if the problem is resolved or not.
Apart from trying these solutions, you can also run the System File Checker. At times, an internal conflict can cause the above-mentioned error. If so, you can fix it with the help of SFC Scan.
How do I fix Runtime error in Excel VBA?
To fix the Run-time error in Excel VBA, you need to follow the above-mentioned solutions. You should start the troubleshooting process by verifying the code. However, if nothing works, you must repair the Office installation. In that case, select the Online Repair option instead of Quick Repair.
How do I bypass VBA error in Excel?
There is no way to bypass the VBA error in Excel if you want to use the code. You must resolve the issue in order to use it without any error. A detailed guide of four solutions as mentioned above, and it is recommended to follow all of them to troubleshoot the VBA error in Excel.
Related: How to fix VBA error 400 in Excel.