View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
jmr4h8 jmr4h8 is offline
external usenet poster
 
Posts: 6
Default Need a macro to delete rows

I knew what you meant and replaced clearcontents with delete... im familiar
with vb but have never worked with inside of excel

"Mike H" wrote:

I may have misreda your post if you reall mean delete the rows as opposed to
clear the contents then use this instead

Sub marine()
lastrow = Range("A3").End(xlDown).Row
Range("A3:A" & lastrow - 1).EntireRow.Delete
End Sub

Mike

"Mike H" wrote:

Try

Sub marine()
lastrow = Range("A3").End(xlDown).Row
Range("A3:A" & lastrow - 1).EntireRow.ClearContents
End Sub

Mike

"jmr4h8" wrote:

I need to find the first data occurance in column D and delete all rows above
it except rows 1 and 2.