Automatically delete 9 out of 10 lines

Solved
djipi95 Posted messages 8 Status Member -  
djipi95 Posted messages 8 Status Member -
Hello
I would like to automate a task in xls, which seems quite basic, but I don't have any skills in vba:
It's simply about deleting the first 9 rows, keeping the 10th, and then continuing like that until the end
So I would keep rows 1, 11, 21, 31, 41....
Any ideas on how to program that?
Thank you very much in advance

Djipi95

1 answer

  1. Gyrus Posted messages 3360 Status Member 526
     
    Hello,

    Try with
    Sub Test()
    Dim Line As Long, LastLine As Long
    LastLine = Range("A" & Rows.Count).End(xlUp).Row
    Line = 1
    Do While Line < LastLine
    Rows(Line + 1).Resize(9).Delete
    LastLine = LastLine - 9
    Line = Line + 1
    Loop
    End Sub

    A+
    1
    1. djipi95 Posted messages 8 Status Member
       
      Impeccable!

      Thank you again.
      0