need macro script - repeat to delete 2 rows

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to repeat deleting 2 rows, skipping 1 row, then deleting 2 rows again
and skipping 1 row.

How to run macro on this? Please help.
 
Try:

Sub delete_rows()

Dim r As Range, j As Long

Set r = ActiveSheet.UsedRange
j = r.Rows.Count + r.Row
Set rdel = Cells(j, "A")

k = 0
For i = 1 To j - 1
k = k + 1
If k = 4 Then
k = 1
End If
If k = 3 Then
Else
Set rdel = Union(rdel, Cells(i, "A"))
End If
Next
rdel.EntireRow.Delete

End Sub
 
Thank you. It works, however it delete the columns and keep each row of
column D. I need all info in the row.

How do you figure it out this complicated script? Can you show me how to
use record and stop record in macro easy steps?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top