Summary:
This post is written with the main prospective of providing you all with ample amount of detail regarding Excel runtime error 13. So go through this complete guide to know how to fix runtime error 13 type mismatch.
In our earlier blogs, we have described the commonly found Excel file runtime error 1004, 32809 and 57121. Today in this article we are describing another Excel file runtime error 13.
Run-time error ‘13’: Type Mismatch usually occurs meanwhile the code is executed in Excel. As a result of this, you may get terminated every time from all the ongoing activities on your Excel application.
This run time error 13 also put an adverse effect on XLS/XLSX files. So before this Excel Type Mismatch error damages your Excel files, fix it out immediately with the given fixes.
Apart from that, there are many reasons behind getting the Excel file runtime error 13 when the Excel file gets corrupted this starts showing runtime error.
To recover lost Excel data, we recommend this tool:
This software will prevent Excel workbook data such as BI data, financial reports & other analytical information from corruption and data loss. With this software you can rebuild corrupt Excel files and restore every single visual representation & dataset to its original, intact state in 3 easy steps:
- Download Excel File Repair Tool rated Excellent by Softpedia, Softonic & CNET.
- Select the corrupt Excel file (XLS, XLSX) & click Repair to initiate the repair process.
- Preview the repaired files and click Save File to save the files at desired location.
Error Detail:
Error code: Run-time error ‘13’
Declaration: Excel Type Mismatch error
Here is the screenshot of this error:
Why Am I Getting Excel Runtime Error 13 Type Mismatch?
Following are some reasons for run time error 13 type mismatch:
- When multiple methods or files require to starts a program that uses Visual Basic (VB) environment
- Runtime error 13 often occurs when mismatches occur within the software applications which you require to use.
- Due to virus and malware infection as this corrupts the Windows system files or Excel-related files.
- When you tap on the function or macro present on the menu which is created by another Macro then also you will receive the same run time error 13.
- The runtime error commonly occurs due to the conflict between the software and the operating system.
- Due to the corrupt or incomplete installation of Microsoft Excel software.
- The Run-time Error 13 appears when the users try to run VBA code that includes data types that are not matched correctly. Thus it starts displaying Runtime error 13 type mismatch.
- Due to conflict with other programs while opening the VBA Excel file.
Well, these are some of the common reasons for getting the Excel file runtime error 13.
How To Fix Excel Runtime Error 13 Type Mismatch?
Learn how to Fix Excel Runtime Error 13 Type Mismatch.
1: Using Open and Repair Utility
2. Uninstall The Program
3. Scan For Virus/Malware
4. Recover Missing Macros
5. Run The ‘Regedit’ Command In CMD
6: Create New Disk Partition And Reinstall Windows
7: Use MS Excel Repair Tool
1: Using Open and Repair Utility
There is a ‘File Recovery’ mode within Excel which gets activated automatically when any corruption issue hits your worksheet or workbook.
But in some cases, Excel won’t offer this ‘File Recovery’ mode and at that time you need to use Excel inbuilt tool ‘Open and Repair’.
Using this inbuilt utility tool you can recover corrupted/damaged Excel files. Try the following steps to fix Visual Basic runtime error 13 type mismatch in Excel.
Here follow the steps to do so:
- In the File menu> click “Open”
- And select corrupt Excel file > from the drop-down list of open tab > select “Open and Repair”
- Lastly, click on the “Repair” button.
However, it is found that the inbuilt repair utility fails to repair the severely damaged Excel file.
2. Uninstall The Program
It is found some application and software causes the runtime error.
So, to fix the Excel file error, simply uninstall the problematic apps and programs.
- First, go to the Task Manager and stop the running programs.
- Then in the start menu > select Control Panel.
- In the Control Panel > choose Add or Remove Program.
- Here, you will get the list of installed programs on your PC.
- Then from the list select Microsoft Work.
- Click on uninstall to remove it from the PC.
Hope doing this will fix the Excel file Runtime error 13, but if not then follow the third solution.
3. Scan For Virus/Malware
Virus intrusion is quite a big problem for all Windows users, as it causes several issues for PC and Excel files.
This can be the great reason behind this Runtime 13 error. As viruses damage the core program file of MS Office which is important for the execution of Excel application.
This makes the file unreadable and starts generating the following error message: Visual Basic runtime error 13 type mismatch in Excel
To avoid this error, you need to remove all virus infections from your system using the reliable anti-virus removal tool.
Well, it is found that if your Windows operating system in having viruses and malware then this might corrupt Excel file and as a result, you start facing the runtime file error 13.
So, it is recommended to scan your system with the best antivirus program and make your system malware-free. Ultimately this will also fix runtime error 13.
4. Recover Missing Macros
Well, as it is found that users are getting the runtime error 13 due to the missing macros, So try to recover the missing Macros.
Here follow the steps to do so:
- Open the new Excel file > and set the calculation mode to Manual
- Now from the Tools menu select Macro > select Security > High option.
- If you are using Excel 2007, then click the Office button > Excel Options > Trust Center in the left panel
- And click on Trust Center Settings button > Macro Settings > Disable All Macros without Notification in the Macro Settings section > click OK twice.
- Now, open the corrupted workbook. If Excel opens the workbook a message appears that the macros are disabled.
- But if in case Excel shut down, then this method is not workable.
- Next press [Alt] + [F11] for opening the Visual Basic Editor (VBE).
- Make use of the Project Explorer (press [Ctrl]+R) > right-click a module > Export File.
- Type name and folder for the module > and repeat this step as many times as required to export the entire module.
- Finally, close the VBE and exit.
Now open the new blank workbook (or the recently constructed workbook that contains recovered data from the corrupted workbook) and import the modules.
5. Run The ‘Regedit’ Command In CMD
This Excel error 13 can also be fixed by running the ‘Regedit’ command in the command prompt.
- In the search menu of your system’s start menu type run command.
- Now in the opened run dialog box type “regedit” command. After that hit the OK
- This will open the registry editor. On its right side there is a ‘LoadApplnit_DLLs value.’ option, just make double-tap to it.
- Change the value from 1 to ‘0‘and then press the OK.
- Now take exit from this opened registry editor.
- After completing all this, restart your PC.
Making the above changes will definitely resolve the Runtime Error 13 Type Mismatch.
6: Create New Disk Partition And Reinstall Windows
If even after trying all the above-given fixes Excel type mismatched error still persists. In that case, the last option left here is to create the new partition and reinstall Windows.
- In your PC insert windows DVD/CD and after that begin the installation procedure.
- For installation, choose the language preference.
- Tap to the option” I accept” and then hit the NEXT
- Select the custom advance option and then choose the Disk O partition 1
- Now hit the delete> OK button.
- The same thing you have to repeat after selecting the Disk O partition 2.
- Now hit the delete> OK button to delete this too.
- After completing the deletion procedure, tap to create a new partition.
- Assign the disk size and tap to the Apply.
- Now choose the Disk 0 partition 2 and then hit the Formatting.
- After complete formatting, hit the NEXT button to continue.
Note: before attempting this procedure don’t forget to keep a complete backup of all your data.
However, if you are still facing the Excel Runtime file error 13 then make use of the third party automatic repair tool.
7: Use MS Excel Repair Tool
It is recommended to make use of the MS Excel Repair Tool. This is the best tool to repair all sort of issues, corruption, errors in Excel workbooks. This tool allows to easily restore all corrupt excel file including the charts, worksheet properties cell comments, and other important data.
* Free version of the product only previews recoverable data.
This is a unique tool to repair multiple excel files at one repair cycle and recovers the entire data in a preferred location. It is easy to use and compatible with both Windows as well as Mac operating systems.
Steps to Utilize MS Excel Repair Tool:
Final Verdict:
After reading the complete post you must have got enough idea on Visual Basic runtime error 13 type mismatch in Excel. Following the listed given fixes you are able to fix the Excel runtime file error 13.
I tried my best to provide ample information about the runtime error and possible workarounds that will help you to fix the Excel file error.
So, just make use of the solutions given and check whether the Excel error is fixed or not.
In case you have any additional workarounds that proved successful or questions concerning the ones presented, do tell us in the comments.
Hope you find this post informative and helpful.
Thanks for reading…!
Priyanka is an entrepreneur & content marketing expert. She writes tech blogs and has expertise in MS Office, Excel, and other tech subjects. Her distinctive art of presenting tech information in the easy-to-understand language is very impressive. When not writing, she loves unplanned travels.
I created a macro for a file and first it was working fine, but today I’ve been opening and restarting the file and macro hundreds of times and I’m always getting the following error:
Excel VBA Run-time error ’13’ Type mismatch
I didn’t change anything in the macro and don’t know why am I getting the error. Furthermore it takes ages to update the macro every time I put it running (the macro has to run about 9000 rows).
The error is on the line in the between ** **.
VBA:
Sub k()
Dim x As Integer, i As Integer, a As Integer
Dim name As String
name = InputBox("Please insert the name of the sheet")
i = 1
Sheets(name).Cells(4, 58) = Sheets(name).Cells(4, 57)
x = Sheets(name).Cells(4, 57).Value
Do While Not IsEmpty(Sheets(name).Cells(i + 4, 57))
a = 0
If Sheets(name).Cells(4 + i, 57) <> x Then
If Sheets(name).Cells(4 + i, 57) <> 0 Then
If Sheets(name).Cells(4 + i, 57) = 3 Then
a = x
Sheets(name).Cells(4 + i, 58) = Sheets(name).Cells(4 + i, 57) - x
x = Cells(4 + i, 57) - x
End If
**Sheets(name).Cells(4 + i, 58) = Sheets(name).Cells(4 + i, 57) - a**
x = Sheets(name).Cells(4 + i, 57) - a
Else
Cells(4 + i, 58) = ""
End If
Else
Cells(4 + i, 58) = ""
End If
i = i + 1
Loop
End Sub
I’m using excel 2010 on windows 7.
Vega
27.5k27 gold badges94 silver badges101 bronze badges
asked Jan 16, 2012 at 19:52
1
You would get a type mismatch if Sheets(name).Cells(4 + i, 57)
contains a non-numeric value. You should validate the fields before you assume they are numbers and try to subtract from them.
Also, you should enable Option Strict
so you are forced to explicitly convert your variables before trying to perform type-dependent operations on them such as subtraction. That will help you identify and eliminate issues in the future, too.
Unfortunately Option Strict
is for VB.NET only. Still, you should look up best practices for explicit data type conversions in VBA.
Update:
If you are trying to go for the quick fix of your code, however, wrap the **
line and the one following it in the following condition:
If IsNumeric(Sheets(name).Cells(4 + i, 57))
Sheets(name).Cells(4 + i, 58) = Sheets(name).Cells(4 + i, 57) - a
x = Sheets(name).Cells(4 + i, 57) - a
End If
Note that your x
value may not contain its expected value in the next iteration, however.
answered Jan 16, 2012 at 19:55
Devin BurkeDevin Burke
13.6k12 gold badges55 silver badges82 bronze badges
5
Thank you guys for all your help! Finally I was able to make it work perfectly thanks to a friend and also you!
Here is the final code so you can also see how we solve it.
Thanks again!
Option Explicit
Sub k()
Dim x As Integer, i As Integer, a As Integer
Dim name As String
'name = InputBox("Please insert the name of the sheet")
i = 1
name = "Reserva"
Sheets(name).Cells(4, 57) = Sheets(name).Cells(4, 56)
On Error GoTo fim
x = Sheets(name).Cells(4, 56).Value
Application.Calculation = xlCalculationManual
Do While Not IsEmpty(Sheets(name).Cells(i + 4, 56))
a = 0
If Sheets(name).Cells(4 + i, 56) <> x Then
If Sheets(name).Cells(4 + i, 56) <> 0 Then
If Sheets(name).Cells(4 + i, 56) = 3 Then
a = x
Sheets(name).Cells(4 + i, 57) = Sheets(name).Cells(4 + i, 56) - x
x = Cells(4 + i, 56) - x
End If
Sheets(name).Cells(4 + i, 57) = Sheets(name).Cells(4 + i, 56) - a
x = Sheets(name).Cells(4 + i, 56) - a
Else
Cells(4 + i, 57) = ""
End If
Else
Cells(4 + i, 57) = ""
End If
i = i + 1
Loop
Application.Calculation = xlCalculationAutomatic
Exit Sub
fim:
MsgBox Err.Description
Application.Calculation = xlCalculationAutomatic
End Sub
bpeterson76
12.9k4 gold badges48 silver badges82 bronze badges
answered Jan 17, 2012 at 16:50
DiogoDiogo
1511 gold badge1 silver badge5 bronze badges
1
Diogo
Justin has given you some very fine tips 🙂
You will also get that error if the cell where you are performing the calculation has an error resulting from a formula.
For example if Cell A1 has #DIV/0! error then you will get “Excel VBA Run-time error ’13’ Type mismatch” when performing this code
Sheets("Sheet1").Range("A1").Value - 1
I have made some slight changes to your code. Could you please test it for me? Copy the code with the line numbers as I have deliberately put them there.
Option Explicit
Sub Sample()
Dim ws As Worksheet
Dim x As Integer, i As Integer, a As Integer, y As Integer
Dim name As String
Dim lastRow As Long
10 On Error GoTo Whoa
20 Application.ScreenUpdating = False
30 name = InputBox("Please insert the name of the sheet")
40 If Len(Trim(name)) = 0 Then Exit Sub
50 Set ws = Sheets(name)
60 With ws
70 If Not IsError(.Range("BE4").Value) Then
80 x = Val(.Range("BE4").Value)
90 Else
100 MsgBox "Please check the value of cell BE4. It seems to have an error"
110 GoTo LetsContinue
120 End If
130 .Range("BF4").Value = x
140 lastRow = .Range("BE" & Rows.Count).End(xlUp).Row
150 For i = 5 To lastRow
160 If IsError(.Range("BE" & i)) Then
170 MsgBox "Please check the value of cell BE" & i & ". It seems to have an error"
180 GoTo LetsContinue
190 End If
200 a = 0: y = Val(.Range("BE" & i))
210 If y <> x Then
220 If y <> 0 Then
230 If y = 3 Then
240 a = x
250 .Range("BF" & i) = Val(.Range("BE" & i)) - x
260 x = Val(.Range("BE" & i)) - x
270 End If
280 .Range("BF" & i) = Val(.Range("BE" & i)) - a
290 x = Val(.Range("BE" & i)) - a
300 Else
310 .Range("BF" & i).ClearContents
320 End If
330 Else
340 .Range("BF" & i).ClearContents
350 End If
360 Next i
370 End With
LetsContinue:
380 Application.ScreenUpdating = True
390 Exit Sub
Whoa:
400 MsgBox "Error Description :" & Err.Description & vbNewLine & _
"Error at line : " & Erl
410 Resume LetsContinue
End Sub
answered Jan 16, 2012 at 23:15
Siddharth RoutSiddharth Rout
146k17 gold badges206 silver badges250 bronze badges
3
For future readers:
This function was abending in Run-time error '13': Type mismatch
Function fnIsNumber(Value) As Boolean
fnIsNumber = Evaluate("ISNUMBER(0+""" & Value & """)")
End Function
In my case, the function was failing when it ran into a #DIV/0!
or N/A
value.
To solve it, I had to do this:
Function fnIsNumber(Value) As Boolean
If CStr(Value) = "Error 2007" Then '<===== This is the important line
fnIsNumber = False
Else
fnIsNumber = Evaluate("ISNUMBER(0+""" & Value & """)")
End If
End Function
answered Jun 21, 2018 at 15:45
cssyphuscssyphus
37.4k18 gold badges91 silver badges109 bronze badges
Sub HighlightSpecificValue()
'PURPOSE: Highlight all cells containing a specified values
Dim fnd As String, FirstFound As String
Dim FoundCell As Range, rng As Range
Dim myRange As Range, LastCell As Range
'What value do you want to find?
fnd = InputBox("I want to hightlight cells containing...", "Highlight")
'End Macro if Cancel Button is Clicked or no Text is Entered
If fnd = vbNullString Then Exit Sub
Set myRange = ActiveSheet.UsedRange
Set LastCell = myRange.Cells(myRange.Cells.Count)
enter code here
Set FoundCell = myRange.Find(what:=fnd, after:=LastCell)
'Test to see if anything was found
If Not FoundCell Is Nothing Then
FirstFound = FoundCell.Address
Else
GoTo NothingFound
End If
Set rng = FoundCell
'Loop until cycled through all unique finds
Do Until FoundCell Is Nothing
'Find next cell with fnd value
Set FoundCell = myRange.FindNext(after:=FoundCell)
'Add found cell to rng range variable
Set rng = Union(rng, FoundCell)
'Test to see if cycled through to first found cell
If FoundCell.Address = FirstFound Then Exit Do
Loop
'Highlight Found cells yellow
rng.Interior.Color = RGB(255, 255, 0)
Dim fnd1 As String
fnd1 = "Rah"
'Condition highlighting
Set FoundCell = myRange.FindNext(after:=FoundCell)
If FoundCell.Value("rah") Then
rng.Interior.Color = RGB(255, 0, 0)
ElseIf FoundCell.Value("Nav") Then
rng.Interior.Color = RGB(0, 0, 255)
End If
'Report Out Message
MsgBox rng.Cells.Count & " cell(s) were found containing: " & fnd
Exit Sub
'Error Handler
NothingFound:
MsgBox "No cells containing: " & fnd & " were found in this worksheet"
End Sub
Neil
54.3k8 gold badges60 silver badges72 bronze badges
answered Oct 9, 2015 at 10:10
I had the same problem as you mentioned here above and my code was doing great all day yesterday.
I kept on programming this morning and when I opened my application (my file with an Auto_Open sub), I got the Run-time error ’13’ Type mismatch, I went on the web to find answers, I tried a lot of things, modifications and at one point I remembered that I read somewhere about “Ghost” data that stays in a cell even if we don’t see it.
My code do only data transfer from one file I opened previously to another and Sum it. My code stopped at the third SheetTab (So it went right for the 2 previous SheetTab where the same code went without stopping) with the Type mismatch message. And it does that every time at the same SheetTab when I restart my code.
So I selected the cell where it stopped, manually entered 0,00 (Because the Type mismatch comes from a Summation variables declared in a DIM as Double) and copied that cell in all the subsequent cells where the same problem occurred. It solved the problem. Never had the message again. Nothing to do with my code but the “Ghost” or data from the past. It is like when you want to use the Control+End and Excel takes you where you had data once and deleted it. Had to “Save” and close the file when you wanted to use the Control+End to make sure Excel pointed you to the right cell.
TylerH
20.6k64 gold badges72 silver badges97 bronze badges
answered Oct 11, 2013 at 19:14
This error occurs when the input variable type is wrong. You probably have written a formula in Cells(4 + i, 57)
that instead of =0
, the formula = ""
have used. So when running this error is displayed. Because empty string is not equal to zero.
answered Dec 13, 2016 at 21:12
gadolfgadolf
1,01511 silver badges19 bronze badges
Facing error with Excel application that you use in your day to day routine, whether regularly or seldom; at home or in the workplace, is unquestionably an undesired circumstance. The problem increases when the error that you have found, is remote or for the first time. Both MS Excel XLS and XLSX files become unreliable or corrupt at times and may return different errors including Microsoft visual basic runtime error 13 type mismatch in excel.
Other
than Excel runtime 1004, 32809, 57121 error; Excel Runtime Error 13 also
affects MS Excel or its XLS/XLSX files. If you have no idea to resolve the
error as fast as possible, it is obvious you to get baffled. This technical
post is a purpose to assist you to resolve the runtime error 13. So know the
error: its causes and fixes here.
Introduction to MS Excel Runtime Error 13
The
Excel runtime file error 13 is a type of mismatch error in MS Excel. Normally,
it arises when one or more files or methods are needed to begin a program that
operates the Visual Basic (VB) environment by default. This means the error
occurs when Excel users try to run VBA code including data types that are not
met in the correct manner. Consequently, ‘runtime error 13: type mismatch
Excel’ appears in Microsoft Excel.
What causes runtime error 13 type mismatch in excel?
Following
are the reason for runtime error 13 in excel:
- Flawed or unfinished installation of
MS Excel application in the system. - The clash between the Excel
application program and Win operating system. - When the user clicks a missing menu
function or a macro from an Excel file. - A faulty code infection or
virus/malware attack makes excel files prone to corruption. - Collide with other programs while
launching a VBA Excel file.
Techniques to Resolve MS Excel runtime error 13 Type Mismatch Excel
#Technique 1: Using Open and
Repair Utility
The
MS Excel automatically provides ‘File Recovery’ mode when it detects a
corrupted workbook or worksheet. It does this to fix the damaged Excel files.
But sometimes Excel does not give the
‘File Recovery’ mode automatically. This is the time when you can use ‘Open and
Repair’, an inbuilt utility in Excel to restore damaged Excel files. Use this
technique to fix Microsoft visual basic runtime error 13 type mismatch in Excel:
- Open Excel application.
- Navigate to the File menu and click
on the Open button. - Choose the ‘Excel’ file.
- Click the ‘Open’ dropdown list.
- Click the ‘Open and Repair’ button.
- Click the ‘Repair’ button to recover
maximum possible data Or Click the ‘Extract Data’ tab to secure values and
formulae.
#Technique 2: Uninstall the ‘error causing excel’
It is observed that unusual applications programs and software
cause runtime error. Uninstall those applications or software to fix the Excel
file runtime error. To do so, the actions are:
- Go to ‘Task Manager’ and stop the error
causing programs one by one. - Click the ‘Start’ menu.
- Click ‘Control Panel’ button.
- Select ‘Add or Remove Program’ in Control
Panel. - All the installed programs on the PC are
enlisted. - Select MS Excel and click ‘Uninstall’ to
remove it from the PC.
#Technique 3: Repair Windows Registry
- Navigate to Windows Registry on your
PC. - In Windows registry editor open
HKEY_LOCAL_MACHINE_Software. - Click on Software and select
Microsoft >> Windows then, select Current version >> Run. - Now, choose the error file and
Delete it. - After here, reboot your system.
#Technique 4: Use SysInfoTools Excel Repair
Software
An expert Excel file repair software by SysInfoTools that strongly repairs infected Excel XLS and XLSX files without any trouble. Recover all-important Excel file components: table, chart, chart sheet, formula, cell comment, image, sort, filter, etc. without data loss or change in the structure or data alteration of the files. With a user-friendly and habitual interface having quickly accessible tabs, buttons, and menus, the Excel file repair process is easy and saves time.
Final Verdict
This blog explains Microsoft visual basic runtime error 13 type mismatch in Excel in detail. Now you can fix Excel runtime error by using any of the above-discussed techniques. If you want to learn How to Recover Unsaved Excel File Windows then read here. I hope you like the post. Thanks
Summary: The Excel runtime error 13 can occur while running Excel VBA projects. The Excel users triggers this error if there is a mismatch in datatype in the VBA code. Additionally, there can be other causes. This blog will discuss the possible causes of the error and their solutions. It also mentions Stellar Repair for Excel if the runtime error 13 occurs due to corruption in the Excel file.
Contents
- Excel Runtime Error 13
- Causes for Excel Runtime Error 13
- Fixes
- Limitations
- Conclusion
Encountering error with Excel application that you use every day, whether frequently or sometimes; at home or in office, is undoubtedly an unwanted situation. The trouble doubles when the error that you have encountered, is unknown or for the first time. Both Excel XLS and XLSX files become corrupt or damaged at times and may return different errors including runtime errors.
A runtime error that commonly affects MS Excel or its XLS/XLSX files other than Excel runtime 1004, 32809, 57121 error, etc. is Excel Runtime Error 13. Not knowing what to do when there is a time constraint to resolve the error, it is evident for you to get perplexed. This blog is an intent to help you resolve the terrible situation you are experiencing due to runtime error 13. Know all about the error: what is it, its causes and the fixes.
Excel Runtime Error 13
The VBA runtime file error 13 is a type of mismatch error in Excel. Usually, it arises when one or more files or processes are required to launch a program that employs the Visual Basic (VB) environment by default. This means the error occurs when Excel users try to run VBA code containing data types that are not matched in the correct manner. Consequently, ‘runtime error 13: type mismatch Excel’ appears in Excel.
Causes for Excel Runtime Error 13
The Excel runtime error 13 causes are as follows:
- Damaged or incomplete installation of MS Excel application
- The conflict between the Excel application and Operating System
- When a missing menu function or a macro is clicked on by the user from Excel file
- Virus/malware attack or malicious code infection damaging Excel files
- Conflict with other programs while VBA Excel file is open
Fixes
The methods to fix Excel runtime error 13 are as follows:
Fix 1: Make use of the ‘Open and Repair’ utility
MS Excel automatically provides ‘File Recovery’ mode when it discovers a damaged workbook or worksheet. It does this to repair the damaged Excel files. But there are times when Excel does not provide the ‘File Recovery’ mode automatically. This is the time when you can employ ‘Open and Repair’, an inbuilt utility to repair Excel files. The steps to use this utility are:
- Open Excel application
- Go to File->Open
- Select the ‘Excel’ file
- Click the ‘Open’ dropdown
- Click ‘Open and Repair..’ button
- Click ‘Repair’ button to recover as much work as possible Or Click ‘Extract Data’ tab to extract values and formulae
Note: If Open and Repair process is not successful using ‘Repair’ option, use ‘Extract Data’
Fix 2: Uninstall the ‘error causing program’
It is found that some application and software cause the runtime error. Uninstall those application or software to fix the Excel file runtime error. To do so, the steps are:
- Go to ‘Task Manager’ and stop the error causing programs one by one
- Click ‘Start’ menu
- Click ‘Control Panel’ button
- Select ‘Add or Remove Program’ or “uninstall a program” option in Control Panel
- All the installed programs on the PC is enlisted
- Select MS Office and click ‘Uninstall’ to remove it from the PC
Limitations
Using Microsoft’s Open & Repair Utility and uninstalling error causing software-programs may or may not resolve Excel Runtime Error 13. In that case a sure-shot and reliable software helps in resolving the error.
Fix 3: Use Stellar Repair for Excel
A professional Excel file repair software that successfully repairs damaged Excel .XLS and .XLSX files without hassle. Recovers all important Excel file components: table, chart, chart sheet, formula, cell comment, image, sort, filter, etc. without data loss or change in the structure or formatting of the files. With a user-friendly and intuitive interface having easily accessible tabs, buttons, and menus, the Excel repair process is easy and saves time.
Conclusion
You are now aware of the Excel runtime error 13, its causes and steps to resolve it, if the same occurs in Excel XLS/XLSX file. All the three fixes that the blog suggests, are effective in addressing the error. However, Stellar Repair for Excel makes your task of removing Excel runtime errors easy while offering multiple advantages. The software shows a preview of the repaired Excel file data before saving it. Along with resolving Excel Runtime Error 13, the software also resolves other errors associated with MS Excel. Further, it maintains workbook properties, cell formatting and overall structure to provide the real-time recovery of Excel file.
About The Author
Priyanka
Priyanka is a technology expert working for key technology domains that revolve around Data Recovery and related software’s. She got expertise on related subjects like SQL Database, Access Database, QuickBooks, and Microsoft Excel. Loves to write on different technology and data recovery subjects on regular basis. Technology freak who always found exploring neo-tech subjects, when not writing, research is something that keeps her going in life.
Home > VBA > VBA Type Mismatch Error (Error 13)
Type Mismatch (Error 13) occurs when you try to specify a value to a variable that doesn’t match with its data type. In VBA, when you declare a variable you need to define its data type, and when you specify a value that is different from that data type you get the type mismatch error 13.
In this tutorial, we will see what the possible situations are where runtime error 13 can occurs while executing a code.
Type Mismatch Error with Date
In VBA, there is a specific data type to deal with dates and sometimes it happens when you using a variable to store a date and somehow the value you specify is different.
In the following code, I have declared a variable as the date and then I have specified the value from cell A1 where I am supposed to have a date only. But as you can see the date that I have in cell one is not in the correct format VBA is not able to identify it as a date.
Sub myMacro()
Dim iVal As Date
iVal = Range("A1").Value
End Sub
Type Mismatch Error with Number
You’re gonna have you can have the same error while dealing with numbers where you get a different value when you trying to specify a number to a variable.
In the following example, you have an error in cell A1 which is supposed to be a numeric value. So when you run the code, VBA shows you the runtime 13 error because it cannot identify the value as a number.
Sub myMacro()
Dim iNum As Long
iNum = Range("A6").Value
End Sub
Runtime Error 6 Overflow
In VBA, there are multiple data types to deal with numbers and each of these data types has a range of numbers that you can assign to it. But there is a problem when you specify a number that is out of the range of the data type.
In that case, we will show you runtime error 6 overflow which indicates you need to change the data type and the number you have specified is out of the range.
Other Situations When it can Occurs
There might be some other situations in that you could face the runtime error 14: Type Mismatch.
- When you assign a range to an array but that range only consists of a single cell.
- When you define a variable as an object but by writing the code you specify a different object to that variable.
- When you specify a variable as a worksheet but use sheets collection in the code or vice versa.
How to Fix Type Mismatch (Error 13)
The best way to deal with this error is to use to go to the statement to run a specific line of code or show a message box to the user when the error occurs. But you can also check the court step by step before executing it. For this, you need to use VBA’s debug tool, or you can also use the shortcut key F8.