Solutions to open Excel 2019 Read Only Documents | Stellar
Solutions to open Excel Read Only Documents
‘Excel cannot open read-only documents’ is an error message that usually appears when you try to open an Excel (XLS or XLSX) file downloaded from the Internet, email, or the network server. It may also appear when you try to open an encrypted or password-protected Excel document. In such a case, MS Excel prevents the user from making any changes to the document.
Reasons behind the “Excel cannot access ‘xxx.xls.’ The Document may be read-only or encrypted” Error
There could be several reasons that may cause the error. Some of them are as follows:
- Corrupt or damaged Excel workbook
- Incompatible or unsupported add-in
- Antivirus or malware software conflict
- Read-Only Excel file
- The file is encrypted
- File or drive read/write permissions issues
- Protected Excel workbook
- Damaged or missing MS Office (MS Excel) program files
Solutions to Open and Edit Read-Only Excel Documents
Below are a few solutions that can help you fix the ‘Excel cannot access ‘xxx.xls.’ The Document may be read-only or encrypted’ error and allow you to open and edit Excel documents.
- Remove Read-only Attribute from Excel File Properties
The ‘Excel cannot open read-only documents’ error message may appear when the Excel file property is set to read-only. To check if this is the case, follow these steps:
- Right-click on the particular Excel (xls/xlsx) document and select ‘Properties’.
- Uncheck the ‘Read-only’ attribute and then click the ‘OK’ button.
Now try to open the Excel document and check if the problem is fixed.
- Adjust Antivirus Settings
A few antivirus programs block Excel files and other Office documents by opening those in ‘read-only’ mode. In such cases, try adjusting the antivirus settings to open the Excel files normally. This will allow you to edit, modify, and save the Excel workbook without encountering the “Excel cannot access ‘xxx.xls.’ The Document may be a read-only or encrypted” error message.
- Disable Protected-View
The error may appear when you try to open an Excel file received as email attachments or downloaded from unsafe source. The file may potentially contain viruses, worms, or other types of malware that could damage the system or the server.
To safeguard the system, MS Excel opens such files in Protected View. It may also open an Excel workbook in Protected Mode when it detects a problem with the file. This security feature allows you to read or view Excel files and reduces the risks to the computer system or PC.
However, you can click File > Info and then click ‘Edit Anyway‘ to access and edit file content. You may also disable the Protected View setting via File > Options > Trust Center > Trust Center Settings…> Protected View. However, we do not recommend this.
- Renew/Activate Microsoft Office
If MS Office is in a deactivated state or its subscription has expired, the Office documents, including the Excel, could be in ‘read-only reduced functionality mode.’
In such a scenario, activate Microsoft Office or renew the Office subscription. Then open the Excel workbook and check if the problem of ‘Excel cannot open read-only documents’ is resolved.
- Check if OneDrive Storage is Full
If Excel files are saved on OneDrive with low or no storage space, you may encounter such issues with your files.
To know the amount of free space on OneDrive, follow these steps:
- On your PC, open Settings and navigate to OneDrive.
- Click ‘Sync Settings > File Storage‘ to see available space.
You may also visit onedrive.live.com, sign in to the account, and then check the available space. If there’s no space available or the drive is full, empty the storage space and see if the problem is resolved.
- Check and Update MS Office and Windows
Microsoft releases updates to fix known errors. Thus, it is critical to update both Windows and MS Office to the latest release and avoid issues, such as ‘Excel cannot access ‘xxx.xls.’ The Document may be read-only or encrypted.’
- Repair MS Office (MS Excel)
The error ‘Excel cannot open read-only documents’ may appear due to a problem with your MS Office (MS Excel) program. You can repair the MS Office program to resolve such errors. The steps are as follows:
- Open Control Panel and click Uninstall a Program link under Programs.
- Choose Microsoft Office from the list and click the Change button.
- Select Quick Repair and then click Repair to fix problems with MS Office and MS Excel. It will also restore any missing or damaged program files.
After the Repair, open the Excel workbook and check if the error is resolved.
- Check Permissions
The error message may also appear if you access an Excel workbook from a network or shared drive due to lack of write permission. Make sure you have read and write permissions assigned for the particular network drive. Alternatively, you can copy the file from the network drive and save it in your local folder to access and edit it without encountering this error message.
- Repair MS Excel File
If none of the solutions worked, the Excel workbook could be damaged or corrupt. To repair such damaged Excel workbook or spreadsheet, you can use the inbuilt ‘Open and Repair…’ option in MS Excel or install an Excel repair software , such as Stellar Repair for Excel. The software comes in handy when the Open and Repair option fails to fix the Excel workbook problems. It repairs the corrupt or damaged Excel workbook, extracts all components and content from the file with 100% integrity, and saves them in a new Excel workbook.
Conclusion
Sometimes, the ‘Excel cannot open read-only documents’ error can be resolved by a simple restart. But if it doesn’t work, you can follow the solutions discussed in this article to resolve the ‘Excel cannot open read-only documents’ issue. However, if the issue is caused due to a damaged or corrupt Excel workbook, these methods may not work. In such a case, you can use Excel’s inbuilt repair utility, i.e., Open and Repair, or install Stellar Repair for Excel software recommended by MVPs and industry experts to fix all kinds of problems with MS Excel workbooks.
How to Repair Excel Document on a Flash Drive
Summary: Microsoft Excel files are stored on flash drives if they need to be transferred between systems or if they need to be backed up. But sometimes unforeseen issues can corrupt the Excel sheets stored on flash drives. When that happens, it can be an arduous task to repair Excel documents on a flash drive. Through this post let us try to understand the reasons why Excel sheets stored on flash drives can get corrupted and how users can resolve them easily.
In this digital age, we all work with computers, files, and documents. Flash drives or USBs are common ways of storing data in an external place. Be it for a meeting or for a party playlist, these devices come handy when one wants to transfer data or access the files stored elsewhere.
You may need to access your data from another location. That’s when a USB flash drive might come in handy. And, that’s exactly why Excel sheets too end up on flash drives; either that or for backup purposes. However, there are many instances where an Excel file stored in a USB gets corrupted when one tries to access the file. The error message you get while trying to open the Excel file would be a great clue for figuring out the exact reason behind corruption.
This blog will provide insights into what are the reasons for the corruption of a USB and how the users can repair Excel on flash drive that has been corrupted.
Reasons for USB inaccessibility
Sometimes flash drives or USBs can become unresponsive due to numerous reasons. There are two types of corruption – logical and physical. Physical corruptions occur due to broken stems and connectors, broken circuits, NAND gate, not recognised, RAW, need to format, not accessible, and dead drives (no power supply).
One of the main reasons behind such an error could be that the USB drive has been infected by some virus. This can affect any file – not only the ones which are there in the USB drive but also the ones which are there in the PC/Laptop where you connect the USB drive. It is recommended that you scan the USB drive with reliable antivirus software to detect viruses.
There can be various other reasons that may make your USB corrupt or unresponsive. But there are very slim chances that you will be able to recover a flash drive that has physical damage. However, you can try to run the check disk on the USB drive to fix the drive. We will be discussing this as you read on.
Recovery Methods for Corrupted Flash Drives
There are 3 tried and tested recovery methods. Try them and see which one works out for you.
- Restoring Excel Files from Windows backup
To bring back your old Excel files, fixing up the corrupt file is your best option. Importantly note that this method would work only if your system’s Windows backup option has been enabled.
Step-by-step process for restoring your older Excel files:
- Connect your USB drive
- Go to “My Computer”->USB Drive->Check if the file exists
- Right click on the excel file and click on the restore previous versions
- You will now see a list of older versions which were created
- Select one the backups and click on “restore”
- Using Command Line to Recover Excel Files
In case you are looking to repair Excel on flash drive, you can also resolve it by using the command line. Just follow the below steps to see if you can recover the excel files.
- Connect your USB Flash drive
- Open “Run” (press Windows+R) and then open “cmd”
- Type “attrib -h -r -s /s /d (USB Drive Letter):\*.*” where the (USB Drive Letter) is the drive letter you can find using “My Computer”
- Once this has been completed, Windows will start repairing your files
- After the process gets over, try accessing the excel file to see if the data has been recovered
- Running a “Check Disk” on flash drives
Follow the below steps while the USB flash drive has been plugged into your computer:
- Open “Run” and then open “cmd”
- Type in “chkdsk /X /f (USB Drive Letter)” where the “(USB Drive Letter)” is the letter of the corrupted USB Drive. You can get this letter easily from the “My Computer”.
It will now check your disk to and correct any corrupted records.
What if none of these methods works?
In case none of the above methods works to repair Excel document on a flash drive, then you would need a professional Excel repair software such as Stellar Repair for Excel to restore your files. Such software not only help repair corrupted Excel files on flash drives but also help in recovering the data stored within them in their original format.
Stellar Repair for Excel resolves corruption problems in Excel files and recovers all formulas, charts, cell formatting, and more from them. It can repair multiple Excel files in one go. Equipped with a fully interactive GUI, working with this product is extremely easy.
To sum it up
Although flash drives are quite popularly used, they are not the most reliable of storage devices. These drives can fail anytime without warning. Thus, always back up your data on other more robust devices instead of flash drives. We hope that with the above tried and tested methods you will easily be able to repair Excel document on flash drive if need be. For any queries that you have, feel free to leave a comment below!
[Fixed] The Workbook Cannot Be Opened or Repaired By Microsoft Excel
An MS Excel workbook (.XLS/.XLSX) file may not open due to damage or corruption caused by various reasons, such as:
- Sudden power failure
- System crash
- Virus or malware intrusion
- Large or oversized Excel file
- Incompatible add-ins
- Drive errors
- Damaged MS Office/Excel program files
As a result, when you try to open or access a corrupt Excel document, the program displays errors, such as “The workbook cannot be opened or repaired by Microsoft Excel because it is corrupt.” This may lead to a data loss situation.
Methods to Fix ‘The Workbook Cannot Be Opened’ Error
When an Excel workbook gets corrupt, MS Excel automatically detects and starts the file recovery mode to open and repair the file. However, when it fails to repair the corruption or recover the Excel file automatically, it displays the error message, “The workbook cannot be opened or repaired by Microsoft Excel because it is corrupt.” In such a situation, you can follow these methods to repair and recover the Excel document manually.
If the manual methods fail to resolve the error, you can use an Excel repair software, such as Stellar Repair for Excel. The software repairs corrupt XLS/XLSX file, recovers all the data, and saves it in a new Excel document with 100% precision, while keeping the cell formatting and properties intact.
NOTE: Before performing the below methods to repair or recover Excel documents, create a backup copy of the original file. This will help you recover data by using an Excel repair tool and avoid permanent data loss.
1. Repair Excel Workbook Manually
If the automatic repair fails, you may try manual repair to fix the damage or extract the data from the damaged Excel workbook. The steps are as follows:
- Navigate to File > Open and then go to the location where the spreadsheet is located.
- In the Open window, select the corrupted workbook that you want to fix and then click on the arrow next to the Open button.
- From the available options, choose Open and Repair…
- Then click ‘Repair‘ if you want to recover maximum data from the workbook or click ‘Extract data‘ if the repair option fails to fix the issue. It will extract all the values, formulas, tables, etc., from the corrupt workbook.
If both options fail to fix the issue, head to the next method.
2. Remove Faulty or Incompatible Add-ins
Faulty or incompatible add-ins may also cause this error. To find and remove such add-ins, follow these steps:
- Press **Windows key + R.
**
- Type Excel /safe and press ‘Enter‘ or click ‘OK.’ This opens MS Excel in Safe Mode.
- Go to File > Options and then select ‘Add-ins.‘
- Choose ‘Excel Add-ins‘ from Manage: option and then click on the Go button to view all Add-ins.
- Uncheck the checkboxes of Add-ins and then click ‘OK‘ to disable them.
Now close the Excel program and run it normally. Click ‘File > Open‘ and choose the Excel file you want to access.
3. Repair MS Office Installation
Damaged Excel program files may also lead to such errors. However, you can easily repair MS Office installation to fix the problem. The steps are as follows:
- Open Control Panel and select ‘Uninstall a program.‘
- Search and choose MS Office from the programs list. Then click on the ‘Change’ button.
- Select ‘Repair’ and follow the wizard to fix the damaged program files.
If this fails to address the issue, you can uninstall and then fresh install MS Office on your system. Alternatively, try accessing the file on another PC.
4. Use Excel Repair Software
The best option is to use an Excel repair software, such as Stellar Repair for Excel , to repair the file, resolve the error, and access the Excel (XLS/XLSX) worksheet. The software can repair an Excel file without any size limitation.
After recovering the Excel file using the software, you can open it in any MS Excel program without encountering the error message.
Conclusion
A corrupt or damaged Excel workbook may lead to errors, such as “The workbook cannot be opened or repaired by Microsoft Excel because it is corrupt,” and cause a data loss situation. The most efficient way to fix such corrupt Excel files is to repair them by using an Excel repair tool, such as Stellar Repair for Excel.
Unlike manual methods that may fail to resolve the issue or lead to further damage, this software extracts the data from the damaged Excel file and saves it in a new Excel workbook. Thus, it is 100% safe to run on an original Excel file, as it does not overwrite or alter the original file.
The software is free to download. You can scan, repair, and preview a corrupt Excel file by using the demo version. Once you are satisfied with the results, activate the software to save the repaired Excel workbook data in a new sheet.
How to fix Microsoft Excel has stopped working error?
Summary: This blog discusses the possible reasons behind ‘Microsoft Excel has stopped working’ error and solutions to resolve the error manually. You can use Stellar Repair for Excel to quickly repair the file and recover all its data in a hassle-free manner.
Has your Microsoft Excel program stopped working or is acting strange? Excel not responding is a common issue you may experience on launching the application or opening a spreadsheet.
Figure 1 – Microsoft Excel Has Stopped Working Error Message
Possible Causes behind ‘Microsoft Excel has Stopped Working’ Error, and Solutions Thereof
Note: Several users have reported about encountering the ‘Excel has stopped working’ issue on Windows 10, 8, and 7 OS after installing an update for Excel (KB3118373). If you too have installed the update, then uninstall it and check if it solves the error. For detailed information, refer to this link .
How to Resolve ‘Excel found unreadable content in filename.xlsx’ Error in MS Excel?
When opening an Excel spreadsheet in MS Office 2010/2007, you may get the following error message:
“Excel found unreadable content in ‘[filename].xlsx’. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes.”
On clicking ‘Yes’, you may face any of these scenarios:
Note: If you choose to click ‘No’, then open your MS Excel application and click file > Open. When the Open dialog box opens, browse and select the file showing the ‘Excel found unreadable content’ error and then choose ‘Open and Repair’ option. If this didn’t help, try using a third-party Excel repair tool to save time troubleshooting the issue and restoring the file with all its data intact.
Scenario 1: The following message may pop-up.
“Excel was able to open the file by repairing or removing the unreadable content. Excel recovered your formulas and cell values, but
. Click to view log file listing repairs errorxxx.xml.”
The message clearly states that your Excel file might open, but images may be lost and other such inconsistencies can crop up.
Scenario 2: The error is followed by another error message, like “The file is corrupt and cannot be opened“.
Watch our short video for a quick overview of the solutions to fix “Excel found unreadable content in filename.xlsx”
What Causes ‘Excel Unreadable Content’ Error?
You may encounter the ‘Excel file unreadable content’ error due to corruption of complete Excel file or corruption in certain areas (like Pivot Table, Formulas, Styles, or other objects) in the file. According to Microsoft, you may find it difficult to determine the root cause behind Excel file corruption. Corruption could occur in different scenarios, like power surge, a network glitch, copying and pasting corrupted data from another file, etc.
Also Read: How to recover data from corrupt or damaged Excel file 2010 & 2007?
Workarounds to Resolve the ‘Excel found unreadable content in filename.xls’ Error
There is no permanent solution to fix the ‘Excel found unreadable content’ error. But, following are some workarounds you can try to resolve the error.
Note: Before you try any of these workarounds, run Excel with administrator privileges and try opening the Excel file that is throwing the ‘unreadable content’ error. If this doesn’t fix the error, proceed with the workarounds below.
Workaround 1 – Try Opening the File in Excel 2003
Sometimes a problem in the current Excel version might prevent a file from opening. To resolve this error, try opening the problematic file in Excel 2003. If the file opens, save the data in a web page file format (.html) and then try opening the .html file in MS Excel 2010/2007. The detailed step-wise instructions are as follows:
- Open the .xls file in Excel 2003.
- When the file opens, click on File > Save.
- In the ‘Save As’ dialog box, choose Web Page (.html) as the ‘Save as type’ and then click ‘Save.’ Doing so will save everything from your .xls file, opened with 2003, in .html file format.
- Open the .html file in Excel 2010/2007. And then, save the file with .xlsx extension with a new name to avoid overwriting the original file.
Now, open the Excel 2010/2007 file and check if the error is fixed. If not, use the next workaround.
Workaround 2 – Make the Excel File ‘Read-only’
Try to open your ‘.xlsx’ file by making it ‘read-only’. Follow these steps:
- In Excel, click ‘File’ from the main menu.
- Select ‘Save’ for a new document or ‘Save As’ for a previously saved document in the screen that appears.
- From the ‘Save As’ dialog box, click Tools > General Options.
- Click on the ‘Read-only recommended’ checkbox to make the document read-only and then click ‘OK’.
Now open a new ‘.xlsx’ file and copy everything from the corrupt Excel file to this new file. Finally, save this file and try to open it again.
Workaround 3 – Move Excel File to a New Folder
Some users have reported that they could open their Excel file, following the ‘Excel unreadable content’ error, by simply moving the file to a different folder and saving it under a new name. You can also move the affected file to a new folder and try opening it. If this didn’t help resolve the error, follow the next workaround.
Workaround 4 – Install Visual Basic Component
At times, it is seen that installing the ‘Visual Basic’ component of MS Office 2010 resolves the ‘Excel found unreadable content 2010’ error. To do so, follow these steps:
- Navigate to Control Panel > Programs and select Microsoft Office 2010.
- Click ‘Change’ and then select ‘Add or Remove Programs’.
- Next, click the ‘plus’ sign provided next to Office Shared Features.
- Click ‘Visual Basic for Applications’. After that, right-click and choose ‘Run from My Computer’ and hit the ‘Continue’ button.
- Reboot your system when this process finishes.
Now check if the issue has been resolved or not.
What Next?
If none of the workarounds mentioned above works for you, use a professional Excel repair software, such as Stellar Repair for Excel. The software repairs corrupt MS Excel sheets without modifying their original content and formatting. In addition, it can repair single or multiple Excel (XLS/XLSX) files in a few simple steps.
Steps to Repair Corrupt Excel File using Stellar Repair for Excel Software
Install and run Stellar Repair for Excel software.
From the software main interface window, click ‘Browse’ to select the corrupt file. If you are not aware of the corrupt Excel file location, click on the ‘Search’ button.
- Click on the ‘Repair’ button to scan and repair the selected file.
- A preview window will open with recoverable Excel file data. Once satisfied with the preview result, click on the ‘Save File’ button on the ‘File’ menu to start the repair process.
- Select the destination to save the file.
- Click ‘OK’ when the ‘Repaired file saved successfully’ message appears.
The repaired Excel file will get saved at the selected location.
Filter Not Working Error in Excel [Fix 2024]
Summary: The filter is not working issue in Excel can occur due to several reasons, like blank rows, hidden rows, merged cells, corrupted data, etc. In this post, we will mention the reasons why the filter is not working correctly in Excel and several fixes to resolve the issue. We will also mention an advanced Excel repair tool to repair the Excel file if corruption in file is the cause of the issue.
You can use the Filter function in Excel to filter data in large-sized Excel files quickly. While using Excel filters, sometimes, you face a situation where the filter is disabled or may fail to function properly.
The Excel filter usually fails to work if you have not selected the complete and correct range of data. Let’s learn more about the “Sort and Filter not working in Excel” issue and look at the possible methods to fix it.
Why the Filter is not Working in Excel?
You can face the “filter is not working” issue if you are applying the filter on a protected worksheet or trying to find the data from a hidden row. Besides this, there could be many other reasons contributing to this issue, such as:
- The data you are trying to filter is in merged cells.
- The Excel file automatically selected the data up to the first empty cell, excluding the remaining rows.
- Grouped sheets in Excel file.
- Blank row in the Excel sheet.
- You are trying to apply a filter on an invalid data range.
- The workbooks in which you’re facing the filter issues are corrupted.
- You are specifying incorrect criteria in the filter columns.
Solutions to Resolve the Filter is not Working Issue in Excel
There might be two scenarios: the Excel filter option is disabled/grayed out or the filters fail to function properly. You can follow the given troubleshooting solutions to resolve the issue based on the scenario you’re facing.
Scenario 1 – Filter Option is Disabled or Grayed Out
Method 1: Check and Un-group the Worksheet
When you apply filters to a single sheet in a grouped set, Excel disables the filter option in other sheets within the group. You can check the grouped sheets and try ungrouping them to enable the filter option. Here’s how to do so:
- In the Excel file, go to the Group section.
- Right-click on the Ungroup Sheets.
Alternatively, you can press the Shift + Alt + Left keys to ungroup the sheets.
Method 2: Unprotect Worksheet
The “disabled Excel filter” issue can also occur if your worksheet is protected. You can unprotect the worksheet to enable the filter option. To do so, go to the Review tab and then select Unprotect Sheet.
Method 3: Check and Uninstall Excel Add-ins
Sometimes, the Excel filter gets disabled due to faulty or corrupted Excel add-ins. You can run the Excel in Safe mode to check whether the issue has occurred due to add-ins. To do this, type excel /safe in the Run window and click OK.
In safe mode, if you see the filter option, it indicates some problematic Excel add-ins were causing the issue. In such a case, you can check and uninstall the faulty Excel add-ins to fix the issue.
Scenario 2 – Filter is not Working
Method 1: Try Clearing Filters
Sometimes, the Excel filter fails to work correctly if some filters from the previous sessions are still active. In such a case, you can clear the applied filters. Follow the below steps:
- In Excel file, click Sort & Filter option.
- Select clear.
Method 2: Select Entire Data
The filter not working issue in Excel can occur when the range selected for filtering is incomplete or incorrect. You need to make sure that you’ve selected the entire data range in Excel. You can use the Ctrl+A keys to select the entire content in the worksheet.
Method 3: Check and Delete Blank Cells from the Table’s Columns
When you apply a filter to the data, Excel expects data to be in a continuous range. Excel filters do not consider the blank cells, thereby resulting in incorrect functioning of the filter. To resolve this issue, check and delete all blank cells. In case your Excel file is too large to delete the blank cells, then you can add a “Serial number” row as an alternative. Adding serial number row creates a data continuity, thus helping in fixing the filter-related issue.
Method 4: Unhide Hidden Rows and Columns
Hidden rows or columns in worksheets can also affect the filter functionality. You can check and unhide rows/columns to troubleshoot the issue. Here is how to do so:
- In the affected Excel file, go to Home.
- Click on Format > Hide & Unhide.
- Click Unhide Rows or Unhide Columns (as required).
Method 5: Unmerge Cells
You can experience the filter in Excel is not working issue if you are using the filter to extract data from merged cells. Ensure to unmerge the “merged cells” before applying a filter in Excel. Follow the below steps to unmerge the merged cells in Excel:
- Navigate to the Home option.
- In the toolbar, select the Merge & Center option.
- Click Unmerge Cells.
Method 6: Repair the Workbook
Sometimes, the Filter Not Working in Excel issue can occur due to inconsistencies in file structure. If these issues occurred due to corruption in the worksheet, you can repair it using the Open and Repair tool. It is an in-built tool in Excel that is used to repair corrupted Excel files. Here are the steps to use this tool:
- In the Excel application, navigate to the File option.
- Click Open and then click Browse to choose the Excel file.
- In the Open dialog box, click the problematic Excel file.
- Click the arrow next to the Open option and select Open and Repair.
- Click Repair to recover as much data as possible.
- The application prompts a message after the repair process is complete. Click Close.
In most cases, the Open and Repair tool can easily fix corruption issues in the Excel file. However, for any reason, if the open and repair tool doesn’t work you can consider repairing the file using a professional Excel Repair tool. Stellar Repair for Excel is one such advanced and secure tool to repair Excel files. With this tool’s powerful scanning capabilities, you can repair highly corrupted Excel files and recover all their objects with complete integrity. The tool is compatible with all Windows editions, including the latest Windows 11.
Closure
Several reasons are associated with the filter not working issue in Excel. The filter option may not work as expected if you have not selected the complete and correct range of data or for many other reasons. You can follow the troubleshooting methods discussed above to fix the issue. If the filter fails to work due to corruption in the workbook, then try Stellar Repair for Excel . It is an advanced tool that can even repair severely damaged files. It also helps to recover all the data from corrupted files without changing the original formatting. You can check the tool’s functionality by downloading its demo version. It allows you to preview all the repairable objects in the corrupted Excel file.
[Fixed] Excel VBA Runtime Error 9: Subscript Out of Range
Summary: The runtime error 9 in Excel usually occurs when you use different objects in a code or the object you are trying to use is not defined. This post will discuss the reasons behind the Excel VBA error “Subscript out of Range” and the solutions to resolve the issue. It will also mention an Excel repair tool that can help fix the error if it occurs due to corruption in worksheet.
Many users have reported encountering the error “Subscript out of range” (runtime error 9) when using VBA code in Excel. The error often occurs when the object you are referring to in a code is not available, deleted, or not defined earlier. Sometimes, it occurs if you have declared an array in code but forgot to specify the DIM or ReDIM statement to define the length of array.
Causes of VBA Runtime Error 9: Subscript Out Of Range
The error ‘Subscript out of range’ in Excel can occur due to several reasons, such as:
- Object you are trying to use in the VBA code is not defined earlier or is deleted.
- Entered a wrong declaration syntax of the array.
- Wrong spelling of the variable name.
- Referenced a wrong array element.
- Entered incorrect name of the worksheet you are trying to refer.
- Worksheet you trying to call in the code is not available.
- Specified an invalid element.
- Not specified the number of elements in an array.
- Workbook in which you trying to use VBA is corrupted.
Methods to Fix Excel VBA Error ‘Subscript out of Range’
Following are some workarounds you can try to fix the runtime error 9 in Excel.
Method 1: Check the Name of Worksheet in the Code
Sometimes, Excel throws the runtime error 9: Subscript out of range if the name of the worksheet is not defined correctly in the code. For example – When trying to copy content from one Excel sheet (emp) to another sheet (emp2) via VBA code, you have mistakenly mentioned wrong name of the worksheet (see the below code).
1 | Private Sub CommandButton1_Click() |
When you run the above code, the Excel will throw the Subscript out of range error.
So, check the name of the worksheet and correct it. Here are the steps:
- Go to the Design tab in the Developer section.
- Double-click on the Command button.
- Check and modify the worksheet name (e.g. from “emp” to “emp2”).
- Now run the code.
- The content in ‘emp’ worksheet will be copied to ‘emp2’ (see below).
Method 2: Check the Range of the Array
The VBA error “Subscript out of range” also occurs if you have declared an array in a code but didn’t specify the number of elements. For example – If you have declared an array and forgot to declare the array variable with elements, you will get the error (see below):
To fix this, specify the array variable:
1 | Sub FillArray() |
Method 3: Change Macro Security Settings
The Runtime error 9: Subscript out of range can also occur if there is an issue with the macros or macros are disabled in the Macro Security Settings. In such a case, you can check and change the macro settings. Follow these steps:
- Open your Microsoft Excel.
- Navigate to File > Options > Trust Center.
- Under Trust Center, select Trust Center Settings.
- Click Macro Settings, select Enable all macros, and then click OK.
Method 4: Repair your Excel File
The name or format of the Excel file or name of the objects may get changed due to corruption in the file. When the objects are not identified in a VBA code, you may encounter the Subscript out of range error. You can use the Open and Repair utility in Excel to repair the corrupted file. To use this utility, follow these steps:
- In your MS Excel, click File > Open.
- Browse to the location where the affected file is stored.
- In the Open dialog box, select the corrupted workbook.
- In the Open dropdown, click on Open and Repair.
- You will see a prompt asking you to repair the file or extract data from it.
- Click on the Repair option to extract the data as much as possible. If Repair button fails, then click Extract button to recover data without formulas and values.
If the “Open and Repair” utility fails to repair the corrupted/damaged macro-enabled Excel file, then try an advanced Excel repair tool, such as Stellar Repair for Excel. It can easily repair severely corrupted Excel workbook and recover all the items, including macros, cell comments, table, charts, etc. with 100% integrity. The tool is compatible with all versions of Microsoft Excel.
Conclusion
You may experience the “Subscript out of range” error while using VBA in Excel. You can follow the workarounds discussed in this blog to fix the error. If the Excel file is corrupt, then you can use Stellar Repair for Excel to repair the file. It’s a powerful software that can help fix all the issues that occur due to corruption in the Excel file. It helps to recover all the data from the corrupt Excel files (.xls, .xlsx, .xltm, .xltx, and .xlsm) without changing the original formatting. The tool supports Excel 2021, 2019, 2016, and older versions.
- Title: Solutions to open Excel 2019 Read Only Documents | Stellar
- Author: Ian
- Created at : 2024-09-17 23:27:16
- Updated at : 2024-09-23 23:49:17
- Link: https://techidaily.com/solutions-to-open-excel-2019-read-only-documents-stellar-by-stellar-guide/
- License: This work is licensed under CC BY-NC-SA 4.0.