VBA EXCEL. Run time error '13' type mismatch

benjinorth

New Member
Joined
Jul 25, 2016
Messages
13
Hi All,

Having a slight issue, the code I have below works ok if I change each cell in column A individually, however if i try to copy and paste the Target Value over multiple cells in column A I get a run time error '13' type mismatch.
I've highlighted the code where it "debugs" :eeek:

If any one has any suggestions I'd be very grateful.

Code:
Sub worksheet_change(ByVal Target As Range)
Dim lastrow As Integer
lastrow = Range("A" & Rows.Count).End(xlUp).Row
If Not Intersect(Target, Range("A2:A" & lastrow)) Is Nothing Then
[COLOR=#ff0000]    If Target.Value = "0) N/A - Client not eligible" Then[/COLOR]
        Target.Offset(, 223) = vbNullString
        Target.Offset(, 224) = vbNullString
        Target.Offset(, 226) = vbNullString
        Target.Offset(, 227) = vbNullString
    Else
End If
End If
End Sub
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Try replacing it with this:

Code:
Sub worksheet_change(ByVal Target As Range)
Dim lastrow As Integer
lastrow = Range("A" & Rows.Count).End(xlUp).Row
If Not Intersect(Target, Range("A2:A" & lastrow)) Is Nothing Then
    For Each c In Intersect(Target, Range("A2:A" & lastrow))
        If c.Value = "0) N/A - Client not eligible" Then
            c.Offset(, 223) = vbNullString
            c.Offset(, 224) = vbNullString
            c.Offset(, 226) = vbNullString
            c.Offset(, 227) = vbNullString
        End If
    Next
End If

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,999
Messages
6,175,882
Members
452,679
Latest member
darryl47nopra

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