Need Help with Deleting Rows

I

indraneel13

I want to delete rows
ie one row that has a certain no in a certain column like 1 in column A

and the next 6 rows that follow

my problem is that this repeats itself many times in the excel sheet
and i am not sure how many times as it varies

so i would like to have a macro which does that


thank you in advance


Regards

Indraneel
 
G

Guest

Sub DeleteRows()
Dim lastrow as Long, i as Long
Dim cell as Range
lastrow = cells(rows.count,1).End(xlup)
for i = lastrow to 1 step -1
set cell = cells(i,1)
if cell = 1 then
cell.Resize(7,1).EntireRow.Delete
end if
Next
End Sub
 

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