fixing code delete rows specific rows based on condition without effect on specific column

  • hello

    i have this code but not work as what i want it delete all of rows while i specified the condition is when column f contains 2/3,1/3 only delete rows theses from b2:i1000 without effect on column a

  • Try...

    Code
    Sub Test()
        Application.ScreenUpdating = False
        Dim i As Long
        Dim Lastrow As Long
        Lastrow = Cells(Rows.Count, 6).End(xlUp).Row
        For i = Lastrow To 1 Step -1
            If Cells(i, 6).Value = "1/3" Or Cells(i, 6).Value = "2/3" Then Rows(i).Delete Shift:=xlUp
        Next
        Application.ScreenUpdating = True
    End Sub

    If I've been helpful, let me know. If I haven't, let me know that too. 

  • Code
    Sub Test()
        Application.ScreenUpdating = False
        Dim i As Long
        Dim Lastrow As Long
        Lastrow = Cells(Rows.Count, 6).End(xlUp).Row
        For i = Lastrow To 1 Step -1
            If Cells(i, 6).Value = "1/3" Or Cells(i, 6).Value = "2/3" Then Cells(i, 4).Resize(, 4).ClearContents
        Next
        Application.ScreenUpdating = True
    End Sub

    If I've been helpful, let me know. If I haven't, let me know that too. 

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!