How To Fix Runtime Error 9
Runtime Error 9 appears when you try to copy a Microsoft Visual Basic for Applications module sheet in a Visual Basic macro procedure. It basically means that Visual Basic cannot read the commands / settings that you want it to – leading your system to show the error you’re seeing.
This error is normally displayed like this:
Run-time error ‘9’:
Subscript out of range
What Causes Runtime Error 9
The main cause of this error is when you try and use the “copy” method to copy some sheets into your Excel workbook. If your code looks similar to this, it’s probably the cause of the problem:
“ThisWorkbook.Sheets(“Module2″).Copy before:=ActiveWorkbook.Sheets(1)”
You may also receive the error when the “module sheet” you’re trying to copy was inserted manually in Microsoft Excel; or if a printer was not defined on your computer. In order to resolve the runtime error 9 issue, it is recommended that you add a printer to your system configuration, and install regular Windows updates and clean out the registry of your system. Here’s what you need to do:
How To Fix Runtime Error 9
Step 1 – Add A Printer To Your System
It’s often the case that Visual Basic / Excel will get confused about whether you have a printer installed on your system or not. If you don’t have any printers added to your computer currently, you should try adding one, in order to solve the Runtime Error 9. Here’s what you can do:
- Click Start, the select Control Panel.
- Double-click Printers and Faxes to open the corresponding window.
- Double-click Add Printer to launch the add printer wizard which will help you by following the instructions it provides for you.
Step 2 – Update Windows
Runtime Error 9 is often caused when Windows does not have the required files & updates to help keep it running as smoothly as possible. To ensure this does not cause any of the issues on your PC, you need to be able to update Windows by browsing to the “Control Panel” and then clicking on “Windows Update”. Make sure you allow all the updates to install on your PC.
Step 3 – Scan For Viruses
Viruses are a big problem for Windows, as they continually cause a variety of problems for your PC. One of the biggest causes of runtime error 9 is the way in which many viruses tend to infect the core program files that Windows requires to run. This causes the files to become unreadable, leading Windows to be unable to process the commands you need, leading to it showing the error. To ensure this is not a problem, you need to be able to clean out all the virus infections that your system might have with a virus scanner. Our recommended virus scanner is a program called XoftSpy
Step 4 – Clean Out The Registry
The registry is a big cause of the Runtime 9 error, thanks to the way it’s continually being used by your system. This is a big problem, as it means that Windows is constantly being unable to use the files it needs to run, slowing it down and causing errors such as the Runtime 9 error. To fix this problem, you need to be able to use a ‘registry cleaner’ to repair the various errors that are inside the registry. You can see our recommended registry cleaner below: