0

I have a problem with the following command, as I'm getting a

Runtime error 13 Time Mismatch

in this part:

If Cells(i, "BL").Value = "Started" Then, below the code, what can I change in order for it to run?

Pretty much want to look for the work Started in all the rows in column BL and if so, delete the information in the same row in column AH


    Dim myLastRow As Long
    Dim i As Long
    Application.ScreenUpdating = False
    'Find last row
    myLastRow = Cells(Rows.Count, "BL").End(xlUp).Row
    ' Loop through range
    For i = 2 To myLastRow
        ' If Cells(i, "BL").Value = "Started" Then Range(Cells(i, "AH")).ClearContents
        If Cells(i, "BL").Value = "Started" Then Cells(i, "AH").ClearContents
    Next i
    Application.ScreenUpdating = True


End Sub

1 Answer 1

1

Does Column BL contain one or more error values? If so, you'll need to test for an error first, and then test whether the value is equal to "Start"...

For i = 2 To myLastRow
    ' If Cells(i, "BL").Value = "Started" Then Range(Cells(i, "AH")).ClearContents
    If Not IsError(Cells(i, "BL").Value) Then
        If Cells(i, "BL").Value = "Started" Then Cells(i, "AH").ClearContents
    End If
Next i

Hope this helps!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.