I as Long not working?

30136353

Board Regular
Joined
Aug 14, 2019
Messages
105
Hi, I've used this code many of times and had no problems, but keeping getting a run error 13 now with type mismatch on the below code, anyone Idea?

VBA Code:
    Sub RemovePONs()

    Dim I As Long
    
    I = 3

    Do While Worksheets("Issues").Cells(I, 4) <> ""
    If Worksheets("Issues").Cells(I, 4) = "#N/A" Then
    Rows(I).EntireRow.Delete
    Else: End If
    I = I + 1
    Loop


    End Sub
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
You can't compare an error value to text. If your cells contain errors, you should test them with Iserror or similar, not compare them to text like "#N/A"
 
Upvote 0
You can't compare an error value to text. If your cells contain errors, you should test them with Iserror or similar, not compare them to text like "#N/A"
Thanks Ill fix that, although still getting the original error on line *Do While Worksheets("Issues").Cells(I, 4) <> "" *
 
Upvote 0
You're still comparing the cell value to text. If it's got an error in it, that won't work. Test for the error first, then test for a blank cell after that (on a separate line).
 
Upvote 0

Forum statistics

Threads
1,214,948
Messages
6,122,420
Members
449,083
Latest member
Ava19

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