View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Need Help with Deleting Rows

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

--
Regards,
Tom Ogilvy



" wrote:

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