How to Fix VBA Runtime Error 6 in MS Excel?

Summary: The VBA runtime error 6 in Microsoft Excel can occur due to various reasons. In this post, we will understand the causes behind this VBA runtime error and discuss the methods to resolve the error. We will also mention an Excel repair tool that can help fix this error if the cause is corruption in Excel file.

The runtime (overflow) error 6 in Microsoft Excel usually occurs when you declare a number to the variable but that number is outside the parameters of the specific data type. The data type inbuilt into the VBA denotes the value type you can store in a variable and the range of values you can hold in the variable. For example, a Byte can store values between 0 and 255 and an Integer can store values from -32768 to 32768. So, if you enter a value that is more than the assigned value, then you?ll get the VBA runtime error 6 (overflow).

Some of the error messages related to this error include:

Causes of VBA Runtime Error Code 6

Though the runtime error 6 in MS Excel usually occurs due to incorrect value in the variable, there are various other reasons that can lead to this error. Here are some other common causes of the error:

Methods to Fix VBA Error Code 6 in Microsoft Excel

You need to understand the data types before declaring a variable. However, to fix the issue, you can change the VBA data type or assign a proper value in the variable based on the data type. If the issue still persists, then follow the below methods.

Method 1: Close Conflicting Programs

You may encounter the runtime error when multiple programs conflict with each other. Closing these conflicting programs can resolve the error. Here are the steps:

Method 2: Update Virus Protection Software

Virus infection can lead to the corruption of Excel files, resulting in runtime error 6. Ensure that your antivirus program is updated. If not, update it and scan the system properly.

Method 3: Reinstall Microsoft Visual C++

Runtime errors can occur if updates such as Microsoft Visual C++ are not installed properly. You can reinstall the current Microsoft Visual C++ package to resolve the error. Follow these steps:

Method 4: Reinstall Graphic Driver

This error may also occur if the graphic driver is damaged or outdated. If the runtime error has occurred because of a bad graphic driver, follow these steps to resolve the issue.

Method 5: Run Disk Cleanup

The runtime error might occur due to low storage on your system. You can run Disk Cleanup to free up space on your system. Follow the below instructions:

Method 6: Repair the Excel File

Runtime error 6 can also occur due to a corrupted or damaged Excel file. If this is the case, you can repair your Excel file using the Open and Repair utility in Excel. Here?s how:

If the above utility fails to resolve the issue, using an advanced Excel repair tool can do the job for you. Stellar Repair for Excel is one such tool that can quickly repair Excel files and restore all the data, such as tables, pivot tables, charts, formulas, etc. with 100% integrity. This tool can help fix all types of errors in Excel related to corruption.

Conclusion

If you are facing the VBA runtime error 6 in MS Excel, then try the methods discussed above to resolve the issue. If the cause of the error is corruption in the Excel file, then use an advanced Excel Repair software, such as Stellar Repair for Excel to repair the corrupted Excel file.

Related Post