Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,420
    Thanks
    124
    Thanked 5 Times in 5 Posts

    Deleting Rows (2007)

    Where the text " VA071352 br1" appears I would like to delete the following rows:

    The rows where " VA071352 br1" appears, 23 rows back as well as the next 2 rows after where " VA071352 br1" appears

    The first 12 rows of data on top can be ignored

    It cannot get the macro to delete the rows for eg the first set of rows that must be deleted are row 38:62, 98:122 etc

    Your assistance in this regard will be most appreciated

    Regards

    Howard
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Deleting Rows (2007)

    Try

    Sub Delete_rows()
    Dim LR As Long, I As Long
    Application.ScreenUpdating = False
    LR = Range("A" & Rows.Count).End(xlUp).Row
    For I = LR - 23 To 5 Step -1
    If Range("A" & (I + 23)) Like "*VA071352*br1*" Then
    Range("A" & I).Resize(25).EntireRow.Delete
    End If
    Next I
    End Sub

    Not the lower case br in the line

    If Range("A" & (I + 23)) Like "*VA071352*br1*" Then

  3. #3
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,420
    Thanks
    124
    Thanked 5 Times in 5 Posts

    Re: Deleting Rows (2007)

    Hi Hans

    Thanks for the help

    Code works perfectly

    Regards

    Howard

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •