View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
bodhisatvaofboogie bodhisatvaofboogie is offline
external usenet poster
 
Posts: 93
Default Specific Range Deletion

that by itself didn't work. Make sure you break it down simply for me, I'm
still new to the code stuff :) So perhaps I didn't plug it in correctly.

"Jim Thomlinson" wrote:

Give this a try...

Range("V2", Cells(Rows.Count, "V").End(xlUp).Offset(-10, 0)).Entirerow.Delete

Keep in mind that this will crash if there are less than 10 rows of data...
--
HTH...

Jim Thomlinson


"bodhisatvaofboogie" wrote:

What is a good formula for Deleting a specific range of rows? I am trying to
figure out a way to delete all but the last 10 rows from a large set. I'm
implementing it into a macro, and am struggling with how to get it done. I
currently am experimenting with this:

Dim r As Range
Dim lastrow As Long
lastrow = Cells(Rows.Count, "V").End(xlUp).Row
Set r = Range(Cells(1, "V"), Cells(lastrow - 10, "V"))
r.EntireRow.Delete

Though it's not working. Any better ideas? THANKS !!!!