Run-time error'13: Type Mismatch Error

reubanrao93

New Member
Joined
Dec 7, 2020
Messages
17
Office Version
  1. 365
Platform
  1. Windows
Evening gurus,

This VBA is to delete rows for any cells of Columns I containing "Failed" followed by cells on Column N containing "VALUE!". It works flawlessly for Column I criteria whoever 'Run-time error'13: Type Mismatch Error' occurs on Column N. All the columns has been pasted as value hence the cell VALUE! does not have any reference. Is there anything I'm missing here?

Application.ScreenUpdating = True

Sheets("OUTPUT").Range("I:I").Select
Last = Cells(Rows.Count, "I").End(xlUp).Row
For I = Last To 1 Step -1
If (Cells(I, "I").Value) = "Failed" Then
Cells(I, "A").EntireRow.Delete
End If
Next I

Sheets("OUTPUT").Range("N:N").Select
Last = Cells(Rows.Count, "N").End(xlUp).Row
For N = Last To 1 Step -1

If (Cells(N, "N").Value) = "VALUE!" Then <--- Run-time error'13: Type Mismatch occurs here
Cells(N, "A").EntireRow.Delete
End If
Next N


End Sub
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
13,989
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
Are you sure that you have VALUE! in the cell and not #VALUE!
 

mohadin

Well-known Member
Joined
Mar 22, 2015
Messages
1,091
Office Version
  1. 2013
Platform
  1. Windows
Hi
I guess something like
VBA Code:
If VarType(Cells(N, "N").Value) = vbError Then
 

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
13,989
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
Just
VBA Code:
If Cells(N, "N").Text = "#VALUE!" Then
will probably do if @reubanrao93 does have #VALUE! in the cell.
 
Solution

mohadin

Well-known Member
Joined
Mar 22, 2015
Messages
1,091
Office Version
  1. 2013
Platform
  1. Windows

ADVERTISEMENT

As well
 

Watch MrExcel Video

Forum statistics

Threads
1,127,732
Messages
5,626,566
Members
416,190
Latest member
plee3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top