How do I delete every seventh row?

C

Caroline

I have a big spreadsheet, and need a quick macro or formula to automatically
delete every seventh row.
 
P

PCLIVE

This may not be the best method, but it will work. In this code, it will
only repeat 10 times. If you know how many "7th" rows will need to be
deleted, then you can adjust the "1 To 10" section. Keep in mind that this
code also assumes that the first row to be deleted, will be row 7. Back up
your work before using this. HTH, Paul

Sub Delete7thRow()
r = 7

For i = 1 To 10
Rows(r).Delete
r = r + 6
Next i

End Sub
 
D

Duke Carey

Insert a new column A
Number the first 7 rows of data, from 1 to 7
Copy those numbers to the bottom of the data
Filter the data for 7s in the first column
Select all the data, then press the F5 key, click on the Special button, and
select Visible Cells Only
Delete those cells
"Unfilter" the data
 
D

Don Guillett

something like this.

for i=cells(rows.count,"a").end(xlup).row to 7 step -7
cells(i,"a").entirerow.delete
next i
 

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

Top