Solutions to open Excel 2023 Read Only Documents | Stellar

Solutions to open Excel 2023 Read Only Documents | Stellar

Ian Lv13

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.

error message

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.

Illustrates the 'Read-only' attribute in Excel XLSX document

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.

Protected View

  • 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.

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.

Quick Repair and then click Repair to fix problems

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.

[Solved] : How to Fix MS Excel Crash Issue

Microsoft Excel may stop responding , hang, freeze, or stop working due to several reasons, such as in compatible add-ins. In such a case, you may receive one of the following error messages.

  • Excel has stopped working

Excel has stopped working

  • Excel is not responding

Excel is not responding

  • A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available.

A problem caused the MS Excel to stop working correctly

Why Does Excel Keep Crashing?

If Excel keeps crashing on your PC while opening a workbook, saving Excel file, scrolling or editing cells, etc., it indicates a problem with your Excel program or the Excel file.

Microsoft Excel may crash due to any one or more reasons given below,

  •  Incompatible Add-Ins
  • Outdated MS Excel program
  • Conflict with other programs or antivirus tool
  •  Excel file created by third party software
  • Problem with network connection
  •  Combination of Cell formatting and stylings
  • Problem with MS Office installation
  • Partially damaged or corrupt Excel file

Problems Caused by Excel Crash Issue

Microsoft Excel crash may cause damage to Excel file and also lead to Excel (XLS/XLSX) file corruption.

Such corrupt Excel files can’t be opened or accessed via MS Excel app. If you try to access a corrupt Excel file, MS Excel may fail to open the file or stop responding and crash. Additionally, you may receive the following or similar error message,

Excel files can't be opened or accessed

In such a case, you should immediately try to recover the Excel file. You may do so by restoring the Excel file from backup or by using an Excel File Repair software. Otherwise, continue following this guide.

How to Solve Excel Crash Issue?

Before heading to solutions, follow these troubleshooting steps to resolve the Excel Crash issue.

Step 1: Copy File to Local Drive

If you are trying to access and edit or view an Excel file from a network drive, try moving the file to local drive. This will help you find if there is something wrong with the file or the network.

Step 2: Ensure Sufficient Memory

Excel files can grow fairly large when you start adding lots of formatting and shapes. Make sure that your system has enough RAM to run the application.

Ensure Sufficient Memory

If you often work with large Excel files and complex data values& formulas, then install 64-bit versions of MS Office. It will give you an advantage of larger processing capacities and prevent Excel from crash or freeze.

Step 3: Check If Excel is Open and In Use by Another Process

Open Task Manager and close all processes or apps (tasks) that may be using or have access to your Excel file that you are working on. You can find this detail in status bar of Excel program at the bottom of program window.

Task Manager

After closing the tasks, try to access the Excel file and check if this fixes the performance and crash problem in Excel.

Step 4: Test and Repair Excel File

Create a copy of the Excel file and install Stellar Repair for Excel software. It’s free to download. Scan and repair your Excel file using the software. After repair, save the Excel file at your desired location and then open the Excel file in the MS Excel program.

Stellar Repair for Excel software

This should ideally fix all the issues with Excel.

However, if the Excel program still crashes, the problem lies within the system or program. Follow the solutions discussed in this guide to try to fix the Excel crash issue.

NOTE: To save repaired Excel file using the mentioned software, you must purchase the activation key and activate it.

Solutions to Fix MS Excel Crash Issue

Following are some solutions to resolve problems with MS Excel such as,

  • Excel not responding
  • Excel won’t open
  • Excel keeps crashing

Follow these solutions in the given order. In case a method doesn’t work, move to the next one.

Solution 1: Restart Excel in Safe Mode

By starting MS Excel in safe mode, you can run the program without loading the Excel add-ins and with limited features. But COM add-ins are excluded.

To launch Excel in safe mode, close MS Excel and follow these steps,

  • Create a shortcut of MS Excel (.exe) on Desktop
  • Press and hold the Ctrl key while launching the program
  • Click ‘Yes’ when a prompt appears to confirm

Alternatively, press Windows+R, type excel /safe and press ‘Enter’. Use this to open Excel in safe mode on Windows 10, 8.1, 8, or 7 system.

type excel /safe

Now try to open and access the Excel file and check if the issue is resolved. If it’s not, head on to the next solution.

Solution 2: Check and Remove Faulty Add-ins

In case Excel doesn’t crash in Safe Mode, it’s possible that some faulty add-ins are the culprit behind frequent Excel crash and freeze. These Excel add-ins may interfere or conflict with the Excel program.

Check and Remove Faulty Add-ins

Find and remove the faulty add-in. It can resolve the issue. To do so, follow these steps,

  • Restart Excel in normal mode and go to File> Options> Add-ins
  • Choose COM Add-ins from the drop-down and click Go

COM Add-ins

  • Uncheck all the checkboxes and click OK

Uncheck all the check boxes

  • Restart Excel and check if the issue is resolved
  •  If Excel doesn’t crash or freeze anymore, open COM Add-ins and enable one add-in at a time followed by Excel restart. Then observe Excel for freeze or crash problem

This will help you find out the faulty add-in, which is causing the problem. Remove the add-in which is causing the problem to resolve the issue. If that doesn’t fix, move to the next solution.

Solution 3: Check and Install the Latest Updates

If you haven’t set Windows to Download and Install Updates automatically, do it now.

Apart from updating the operating system, latest Windows updates sometimes fixes bugs for other applications installed on the system such as MS Office. Often installing an important update that you might have missed may correct the Excel crash problem.

You can also update MS Office manually. Follow these steps,

Go to File > Account

 Under Product Information, select Update Options and click Update Now

Product Information

If you have installed MS Excel from Microsoft Store, open the store and update your Office applications.

NOTE: This also works if you can’t open Excel file or Excel crashes after Windows upgrade from Windows 7 or Windows 8/8.1 to Windows 10.

After installing the latest MS Office updates, check if Excel works fine. If not, head to the next solution.

Solution 4: Clear Conditional Formatting Rules

If a sheet is causing Excel to freeze or crash, there might be a problem with that particular sheet. In such a case, you may try clearing the Conditional Formatting rules. The steps are as follows,

  • Under Home, click ‘Conditional Formatting > Clear Rules> Clear Rules from Entire Sheet’

Conditional Formatting

  • You may repeat this step for all other sheets in the Excel workbook
  • Then click File> Save as and save the Sheet as a new file at a different location

This avoids overwriting or making changes to the original Excel file. Once done, try working on the sheet.

If this doesn’t work out, move to the next solution.

Solution 5: Remove Multiple Cell Formatting and Styles

If a workbook is being shared and edited by others on different platforms then it’s possible that many cells are formatted differently. This can cause issues with Excel such as crash and freeze. It can also lead to Excel file corruption. The problem mostly occurs when a workbook contains multiple worksheets using different formatting.

You can follow this guide to remove different cell formats and styles, and then open the Excel file.

Solution 6: Disable Microsoft Excel Animation

Animations require additional processing power and resources. By disabling animations in Excel, you may resolve Excel freeze and crash issue. This also improves MS Excel performance.

To disable the animations in MS Excel, follow these steps:

  • Go to File > Options
  • Click ‘Advanced’ and check ‘Disable hardware graphics acceleration’animation

Disable hardware graphics acceleration

  • Click ‘OK’ to close the window and then restart MS Excel

This has helped many users in fixing the Excel crash issue. If it doesn’t work for you, head to the next solution.

Solution 7: Check If Excel File is Generated by a Third-Party Application

There are applications which you may have used to generate Excel files to fetch data. For instance, downloading data from Google Analytics in Excel format.

Sometimes, these Excel files are not generated correctly by such third-party apps. Thus, some features in Excel may not work as intended when you access the files in MS Excel.

In such a case, you should get in touch with the app developer for help with the file or use Stellar Repair for Excel to repair such Excel files.

Solution 8: Check If Antivirus or Other Apps are Conflicting with MS Excel

Ensure your antivirus is up-to-date and not conflicting with MS Excel. An outdated antivirus tool may conflict with Excel which can cause the application to hang, freeze, or crash.

  • Update your antivirus
  • Try disabling the add-in or integration between Excel and antivirus. See if it works

Alternatively, you may disable the anti-virus tool temporarily to check if it is the culprit behind Excel performance issue and crash. If that resolves the problem, get in touch with your antivirus vendor and report the problem.

They might provide you with a better solution or workaround to fix this problem without disabling the antivirus protection.

IMPORTANT NOTE: Disabling or altering antivirus protection makes your PC vulnerable to malicious attacks and virus or malware intrusion.

Solution 9: Clean Boot Windows to Inspect the Cause Behind Excel Crash

When Windows boot, it starts several processes, services, and application during start up automatically, which runs in the background.

These startup apps and services can interfere with other applications such as MS Excel. To find out if that’s the cause behind Excel crash, you can perform a Clean Boot.

This helps you identify processes, services, or applications that are conflicting with Excel. Steps to perform Clean Boot are as follows,

  • Press Windows key + R, type MSConfig, and press ‘Enter’
  • In System Configuration window, click on the General tab and choose Selective startup

System Configuration

Uncheck ‘Load startup items’ and click ‘OK’

After this, close all running applications and restart your PC

Check if the crash problem with Excel is resolved. Uninstall the conflicting apps or update them. If your issue is not resolved, follow the next solution.

Solution 10: Repair or Reinstall MS Office

Repairing Office programs may also resolve Excel crash issues if caused by damaged MS Excel program or MS Office files. The steps are as follow,

  • Close all MS Office apps and open the Control Panel
  • Click Uninstall a program under Programs

Uninstall a program

  • Click on Microsoft Office and then click on the Change option
  • Choose ‘Quick repair’ and then select ‘Repair’
  • Click ‘Continue’ to repair MS Office installation

You may also try ‘Online Repair’ if this fails to fix the issue. After repair, if the Excel issue persists, reinstall MS Office.

Need More Help?

If none of the above-mentioned solutions worked for you, it indicates that the problem is not with the Excel program but with the Excel file. If you haven’t tried the Stellar Repair for Excel software, do it now.

Select the Excel file which is causing the problem and repair it with the software. It’s a powerful Excel repair software that can fix all the problems with Excel files (XLS/XLSX). It repairs corrupt and severely damaged Excel files.

The software is compatible with all Excel files created using MS Excel 2019, 2016, 2013, 2010, 2007, 2003 or 2000.

After repairing and saving the Excel file, you can open it in your MS Excel program and work on it without any performance issue. To know more about this software, visit this page.

How to Fix Excel File Couldn’t Open in Protected View

Summary: This blog discusses about the Excel error ‘The file couldn’t open in Protected View’ and workarounds to fix the error. If you cannot access the Excel file data, using an Excel file repair tool can help you quickly restore the data to its original state.

Free Download for Windows

Protected View is a feature in Microsoft Excel that opens a file in read-only mode while disabling the editing functions. An Excel file opens in Protected View if the file is from an unsafe location. For example, the file may be opened from an insecure Internet location or downloaded as an Outlook attachment from suspicious senders. In that case, your Excel application won’t let you open the file to protect it against malware or virus attacks.

However, the Protected View feature sometimes prevents an Excel file from opening even if it is from a safe location. Also, opening an Excel file may return an error message ‘file couldn’t open in protected view’.

the file couldn't open in Protected View excel error

You may be able to resolve the issue by closing all the open Excel files, closing the Excel application, and then re-opening the problematic file. But this process can take a significant amount of time as you need to close and re-open the Excel application and the file continuously.

How to Fix the Excel File Couldn’t Open in Protected View Error?

Here are some workarounds to fix the error:

Workaround 1 – Disable the Protected View Settings

Note: Before disabling the protected view settings, ensure you have a reliable antivirus software installed on your computer to safeguard files against malware or virus attacks.

  • Open the Excel file throwing the error, go to File and click the Options tab.
  • From the Options dialog box, go to Trust Center and click on Trust Center Settings.
  • From the Trust Center Settings dialog box, select the Protected View tab.
  • Uncheck the appropriate option under the Protected View section, and then click OK to apply the changes. For instance, uncheck the “Enable Protected View for Outlook attachments” option if the file is a downloaded Outlook attachment.

disable protected view settings

  • Click OK again.

Now try opening the problematic Excel file. If it still doesn’t open, try the following workaround.

Workaround 2 – Repair the Office Installation

Sometimes, corruption in the Office installation may cause Excel to return the ‘file could not open in protected view’ error. So, try repairing your Office installation and check if it solves the problem.

  • Open the Control Panel and click the Uninstall a program option under Programs.
  • Click Uninstall a program under the Programs tab.
  • Right-click the Microsoft Office program you have installed and click the Change button.
  • Select the Repair option and click Continue.

repair office program

Once the repair operation is complete, check if you can open the Excel file without any issue.

Workaround 3 – Install Latest MS Office Updates

Several Excel users have reported about experiencing issues (such as the Protected View issue) on opening an Office document like Excel, Word, or others – after upgrading Windows to a newer version. This problem may occur due to incompatibility between the Office app and the updated Windows version. You can try to fix the problem by upgrading the Office app, and here’s how:

  • Click on the File tab in the Excel file that throws an error.
  • Click the Account tab at the left-hand bottom of the screen.
  • From Office Updates, expand Update Options, and then click Update Now.

office updates

After installing the updates, restart your PC and open the Excel file. If this doesn’t work, use the following workaround.

Workaround 4 – Convert the File and Rename It

Some Excel users resolved the ‘Protected view’ issue by renaming their Excel files. But before that, ensure that the file you are trying to open is saved with .xlsx format. If the file type is .xls, you need to convert it to .xlsx format and then rename it. Before converting the file, save a copy of the original file in the desired location.

If the file type is .xlsx, copy the problematic file. Next, open a blank Excel document and paste the copied file. The file will appear as an icon, double-click on it. If it opens without any error, save it with a different name. Hopefully, reaming the Excel file may help resolve the problem.

Conclusion

There is no fixed solution to resolve the Excel error ‘The file could not open in Protected View’. However, the workarounds discussed in the blog have helped users resolve the ‘Protected View’ issue. Make sure to use the workarounds in the same order as explained in the blog.

If you’re having an issue loading the Excel file data due to the ‘Protected View’ error, consider restoring the data using an Excel file repair tool .

Free Download for Windows

4 Ways to extract data from corrupt Excel file

Summary: Excel files can become corrupt due to numerous reasons. This blog will discuss the reasons behind the corrupted Excel files. Sometimes the file becomes inaccessible. This post includes four ways to extract data from a corrupt Excel file. It also mentioned Stellar Repair for Excel to repair severely corrupted files. The tool helps you recover data from damaged Excel files with complete integrity.

Free Download for Windows

Imagine the frustration of an employee if an Excel workbook he took hours to complete became corrupted for some reason threatening to erase all the data saved in it. Not just that, a corrupted Excel workbook can wreak havoc for the organization too since it poses a risk of permanently deleting critical business information like work records or employee trackers.

Unless a backup of all important Excel files exists, recovering data lost due to damage/corruption to them is next to impossible. However, we’ve conducted some research and found some pretty neat hacks to help you extract data from corrupt excel files without much hassle.

Primary reasons triggering Excel file corruption

As we always point out, to solve a problem for good, getting to its root is imperative. Here are the main reasons that cause Excel file corruption. Knowing these reasons can help you keep Excel corruption at bay for a considerably long time.

  • Abrupt system shutdown when you’re editing an Excel sheet
  • Bugs / Defects in your Excel application or installation
  • Hardware failures like bad sectors on the hard drive where Excel sheets are saved
  • Virus Infection / Malware Attack
  • Excessive data storage within a single Excel file
  • Faulty Excel Macros and CSE Formulas

Depending upon the extent of damage, there can be several ways to perform corrupt Excel file repair.

How to repair corrupt Excel files?

There are a couple of manual methods that can help you repair corrupt Excel files .

  1. If the damaged Excel sheet can be opened, immediately save its copy; thereafter:
    • Open it with a later version of Excel and save it as a new workbook.
    • If this doesn’t work, open it in Excel’s latest version and save the workbook in HTML or HTM format.
    • Once this is done, reopen the HTML file and save again in XLS format.
    • Lastly, open the file and try saving it in SLK format (symbolic link)

Note: It is important to note that saving an Excel workbook in HTML format causes loss of features like custom views, scenarios, unused styles or number formats, natural language formulas, data consolidation settings, custom function categories, etc. In SYLK format only the active worksheet is saved so if using this method, you’ll need to repeat these steps for each worksheet.

  1. Use Excel’s inbuilt Repair function as follows:
    • Launch Microsoft Excel and go to Office button -> Open
    • In the Open dialog box, select the damaged Excel file
    • On the bottom-right corner of the Open dialog box, you will find a drop-down next to Open Click on it and select Open and Repair
    • This will launch the inbuilt Repair module of Excel and you’ll see a dialog box asking you to select an option from Repair or Extract Data
    • Click on Repair to initiate the repair process.
    • If this doesn’t work, repeat steps 1-4, and when Excel asks you to select an option, select Extract Data from corrupt excel file. Thereafter, follow the instruction Excel shows and you should be able to retrieve your data, but you may end up losing some formulas.
  2. If you cannot open the Excel, download Spreadsheet viewer from the Microsoft website and open the file using this program. Thereafter copy all data into a new Excel.

Note: This method will cause much of your formatting, formulas, and more to be lost.

  1. You can download Open Office from its official website OpenOffice.org and try opening the Excel in it. The two programs are very similar so all data should automatically align in the correct place and with the correct formatting.

Note: With this method, VBA code cannot be recovered due to incompatibility between OpenOffice.org and Excel.

Full-proof method for corrupt Excel file repair

If you find the above methods confusing, or you wish to perform Excel file repair without having to face any data and formula loss, or you cannot achieve the desired results with any of these methods, stop wasting any more time with methods that will only frustrate you more. Instead, download the sure-shot solution for dealing with severe Excel corruption –Stellar Repair for Excel  and relax!

free download

Stellar Repair for Excel is the best choice for repairing corrupt or damaged Excel (.XLS/.XLSX) files and restoring everything to a new blank Excel file. This competent software can skillfully repair single as well as multiple XLS/XLSX files while preserving worksheet properties and cell formatting. If you have this product by your side, you don’t need to worry about Excel corruption errors ever again.

To Conclude

Instead of giving up on corrupted Excel sheets, try repairing them with the simple tricks we’ve described. And if they don’t work, keep calm and turn to Stellar Repair for Excel.

[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.

Free Download for Windows

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
2
3
4
5
6
7
8
Private Sub CommandButton1_Click()
Worksheets("emp").Range("A1:E5").Select
Selection.Copy
Worksheets("emp3").Activate
Worksheets("emp3").Range("A1:E5").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub

VBA Error Subscript Out Of Range-When Incorrect Name

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”).

Modified Code From emp to emp2

  • Now run the code.
  • The content in ‘emp’ worksheet will be copied to ‘emp2’ (see below).

Content Copied From emp to emp2

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):

Runtime Error 9 When Not Declared Array

To fix this, specify the array variable:

1
2
3
4
5
6
7
Sub FillArray()
Dim curExpense(364) As Currency
Dim intI As Integer
For intI = 0 to 364
curExpense(intI) = 20
Next
End Sub

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.

Macro Settings In Trust Center

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.

How to Fix the #Value! Error in Excel?

Summary: #Value! is a common error that occurs when using formulas in Excel. It can be due to an issue with the cells you are referencing or use of formulas in the wrong type or format. This blog will discuss some cases when this error may occur and the solutions to fix the issue. You’ll also find about an Excel repair software that can help fix the error if it has occurred due to corruption in Excel file.

Free Download for Windows

You may experience the #Value! error in Excel when trying to enter invalid data type into the formulas. Sometimes, it appears when a value is not the expected type or when dates are given a text value. This Excel error may occur due to several reasons. However, the exact cause of this error is difficult to find. Below, we will be discussing some cases where you may get this error and the solutions to resolve the issues.

Case 1: Wrong Argument Data Type in Formulas

Sometimes, Excel throws the “#Value!” error if it recognizes incompatible arguments in the formulas.

For example: The Date function in the sheet expects only numerical values as arguments. In the below image you can see that when the formula’s string value is used in the month (January), it resulted in the #VALUE! error.

Image of #Value! error in Date Function

Solution

To fix the issue,

  • Double-click the formula to verify the type of arguments.

Image of Solution to fix #Value! error in Excel

  • Correct the argument in the cell (B2).

Image of Correcting Argument In Cell to fix #Value! error in Excel

The formula will work as expected.

Case 2: Using the Basic Subtraction Formula

Users often experience the #Value! error, when using the basic subtraction formula in Excel.

Image of #Value! error in Excel in Subtraction Formula

Solution

Check the formula and the type of values in the cell. If these are correct and the error persists, then follow these steps:

Image of Correcting Basic Subtraction Formula to fix #Value! error in Excel

  • Go to the Start button on Windows, type Control Panel, and double-click on it.
  • Click Clock and Region > Region.

Image of Clock And Region Window in Control Panel to #Value! error in Excel

  • On the Format tab, click Additional Settings.

Image of Region Window For Additional Settings

  • In the Customized Format window, search for List Separator.

Image of Customize Format Window

  • Check if the List Separator is set to minus (-). Change it to comma (,).

Image of Apply List Seperator In Customize Format Window

  • Click OK.
  • Now, open the Excel file and again try to use the formula.

Case 3: Wrong Text Value

The #Value! error can also occur due to the formula’s wrong value.

For example: If you are using the formula to add values in cells and Excel recognizes the unexpected text value, you may get a #Value error.

Image of #Value! error in Excel because of Wrong Text Value

Solution

To fix the issue, you can correct the value or use the SUM function. It is recommended to use functions instead of operations to reduce the errors. In Excel, the formulas with math operators may not able to calculate the text in the cells. The SUM function automatically ignores the text value(er), calculates everything as numbers, and displays the result without the #Value! error.

Image of Highlighting Arguments Of-Sumfunction to fix #Value! error in Excel

Case 4: Blank Space in Cells

You may get the #Value! error if your formula refers to other cells with space or hidden space. Sometimes, spaces that make a cell display blank but actually they are not blank.

Image of #Value! error in Excel because of Blank Space

Solution

You can either delete the space or replace the blank space. Here’s how:

1. Delete the Blank Space

First, check if a cell is blank or not. To do this,

  • Select the cell that looks blank.
  • Press F2.

Image of Blank cell Not Showing Space and hence the #Value! error in Excel

The blank cell won’t show space.

Then, press the Backspace key to delete the space. It will fix the error.

Image of space removed to fix the #Value! error in Excel

2. Replace Blank Space

You can also use the “Find and Select” option to replace the blank space in Excel. Here are the steps:

  • Open the Excel file that shows #Value! error.
  • On the Home tab, click Find & Select > Replace.

Image of Find And Select Option

  • In the Find what field, type a single space and delete everything in the “Replace with” field.

Image of Find And Replace Window

  • Click Replace All > OK.

Image of Result After Replacement With Find-And Select Window

Case 4: Problem with Network Connection

Many users have reported experiencing errors when using Excel online due to problems with the network connection.

Solution

Check your Internet connection and see if it is working properly.  

Case 5: Wrong Formula Format

If you enter the wrong formula with a missing parenthesis or comma, then Excel can throw the #Value! error. The error can also occur if the application finds a special character within a cell.

Solution

Correct the formula and use the ISTEXT function to find the cells with issues.  

Case 6: Corruption in the Excel File

If none of the above works, then it indicates the Excel file is corrupt. The formulas in the Excel file do not work due to corruption.

Solution

You can use the Open and Repair utility in Excel if you are getting the error due to corruption in Excel file. In case the utility fails or the Excel file is severely corrupt, you can use a third-party Excel repair software, such as Stellar Repair for Excel. It is a powerful tool to repair corrupted or damaged Excel files and recover all its data, with 100% integrity. The tool supports Excel 2019, 2016, and older versions.

Closure

There are several reasons that can trigger Excel to throw the #Value! error. It can occur if there is an incorrect argument data type in formulas or blank space, text, or special characters within a cell. This blog discussed the possible scenarios when this error occurs. You can apply the solutions mentioned above to fix the error. If the #Value! error occurs due to corruption in the Excel file, then you can use Stellar Repair for Excel . It is a reliable tool that helps in fixing corruption-related errors in Excel.

Excel AutoRecover not working, what is next?

Consider a Scenario

A professional with Windows 10 computer had MS Office 2016 installed on it. For an official purpose, he worked on an Excel workbook and saved it as an XLSX file. After working for hours on it, which was saved with a file name, a power outage occurred in his building for quite some time. After the power was back, he reopened Excel to find a list of recovered files in ‘Document Recovery’ section on the screen’s left side. However, the file that he had worked on recently was the ‘Original version,’ i.e. the last version saved by him and not the auto-saved Excel file. This meant the Excel document did not have any new data that was entered since the last time he saved it. Consequently, he lost hours of work. According to him, this happened despite the fact that the ‘AutoRecover’ feature was enabled. (Still, this needs to be checked and ensured.)

The ‘AutoRecover’ feature might not work in any of these cases:

  • AutoRecover Feature is disabled - With this feature disabled, the Excel files are not auto-saved if the document is closed without saving, or the document closes unexpectedly due to an untoward incidence. To check, see if ‘Save AutoRecover information every * minutes’ and ‘Keep the last auto-saved version if I close without saving’ checkboxes are checked or unchecked. If either one is unchecked or both are unchecked, it signifies that the AutoRecover feature is disabled. Else, the AutoRecover is enabled.
  • Corruption in the Excel XLSX file – If ‘AutoRecover’ is enabled, most probably the cause is ‘damaged Excel XLSX file.’

Before discussing solutions to resolve the ‘Excel AutoRecover not working’ issue, let’s have an overview of the ‘AutoRecover’ and ‘AutoSave’ features.

A Brief Overview of Excel AutoRecover and AutoSave Feature

AutoRecover is an inbuilt feature in MS Excel 2019, 2016, 2013, 2010, 2003, and 2007 that allows saving all of the ‘open Excel files’ at a fixed-interval in a user-specified location or AutoRecover file location. Besides, AutoSave is an add-in that exists in Excel 2002 and earlier versions to save all open Excel files in case of a crash, power outage, or accidental closure of Excel files without saving. Users can recover these files if Excel closes suddenly, for instance, at the time of power outage or failure. The auto-recovered Excel files are saved at a default location.

Methods to Fix ‘Excel AutoRecover Not Working’ Issue

Manual Methods

Method 1 - Enable the ‘AutoRecover’ Feature if Disabled

Make sure that you have the ‘AutoRecover’ feature enabled in your Excel application. If not, follow these steps to enable it:

  • Open Excel with MS Excel 2016/2019
  • Click on File and then on Options tab
  • In ‘Excel Options’, click on Save tab
  • Check ‘Save AutoRecover information every * minutes’ and ‘Keep the last auto saved version if I close without saving’ box
  • Set the time in ‘Save AutoRecover information every * minutes’
  • Click on the OK button

Note: With this method, it is not possible to recover data from the current Excel file. From next time onwards, the AutoRecover feature starts working following which Excel shall start auto-saving Excel files as per the time set in ‘Save AutoRecover information every * minute’.

Method 2 - Repair Corrupt Excel File

If corruption in Excel XLSX file has resulted in ‘Excel AutoRecover not working’ issue, you will need to repair Excel file . Use ‘Open and Repair’ inbuilt utility to fix and repair the damaged (corrupt) Excel file and extract its data. To use the inbuilt utility, execute the following steps:

  • Go to location “C:\Users\AppData\Local\Microsoft\Office\UnsavedFiles” to find Excel TMP files and save it as XLSX file

Note: In Windows 8, the location is the same as mentioned above that is for Windows 10. In Windows 7, the location is “C:\Users\name\AppData\Roaming\Microsoft\Excel\”

  • Open a blank Excel sheet; click File >> Open
  • Go to the location and folder containing the damaged Excel file
  • In the Open dialog box, choose the damaged Excel file and click the arrow next to the Open button, and then click Open and Repair
  • In the window that appears, click Repair to recover as much data as possible

Now, open the Excel (XLSX) file to check if the Excel file is repaired and its data is recovered.

Use a Professional Excel File Repair Tool

Using a third-party Excel file repair tool can help you repair damaged Excel XLSX file and recover all the data. Stellar Repair for Excel  is one tool you can rely on to repair severely corrupt Excel files (XLSX or XLS).

Here are a few other reasons why you should choose Stellar Repair for Excel software:

  • Repairs Excel file while keeping the worksheet properties and cell formatting same as before.
  • Recovers all of the Excel file components like tables, forms, reports, charts, chart sheets, cell comments, formulas, images, etc.
  • Can batch repair multiple Excel files simultaneously
  • Supports Excel 2019 and earlier versions

Free download Stellar Repair for Excel

Conclusion

To help resolve the problem of ‘AutoRecover not working’, different methods have been discussed, depending on the cause of the problem. These solutions can be implemented to check the possibility of getting back maximum data added in last saved version of the Excel file. However, to fix corruption in the excel file, using a specialized tool such as Stellar Repair for Excel software recommended by MS Excel Experts and MVPs can help. The software can repair severely damaged Excel file easily and efficiently.


Also read:

  • Title: Solutions to open Excel 2023 Read Only Documents | Stellar
  • Author: Ian
  • Created at : 2024-05-20 10:20:29
  • Updated at : 2024-05-21 10:20:29
  • Link: https://techidaily.com/solutions-to-open-excel-2023-read-only-documents-stellar-by-stellar-guide/
  • License: This work is licensed under CC BY-NC-SA 4.0.
On this page
Solutions to open Excel 2023 Read Only Documents | Stellar