Run Time Error

kcpettit13

New Member
Joined
Jun 8, 2016
Messages
5
Hello,

I am getting a Run-time error 13: Type mismatch when I enter anything in column 8 that does not = "YES". The red below is where the error is coming from. Can anyone help?

Thanks!

Private Sub Worksheet_Change(ByVal Target As Range)


If Target.Column = 8 Then
If Target.Value = "YES" Then
Application.EnableEvents = False
Target.EntireRow.Copy Sheets("Completed").Range("A" & Rows.Count).End(xlUp).Offset(1)
Target.EntireRow.Delete
Application.EnableEvents = True
End If

Else
If Target.Column = 11 Then
If Target.Value > 0 Then
Application.EnableEvents = False
Target.EntireRow.Copy Sheets("Missing_Raws").Range("A" & Rows.Count).End(xlUp).Offset(1)
Target.EntireRow.Delete
Application.EnableEvents = True
End If
End If
End If
End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
What are you actually doing when this error occurs? If I just update one cell at a time, it works fine. If I try updating multiple cells at once, I get the error.

I see that error occur if more than one cell is being updated at a time (i.e. you are doing a Copy and Paste, and the Paste is going into multiple cells).
In that case, the size of Target is more than one cell, so then the line:
Code:
If Target.Value = "YES" Then
does not make sense.
You would actually need to loop through each cell in Target.
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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
Back
Top