deleting multiple rows

  • Thread starter Thread starter nerohnze
  • Start date Start date
N

nerohnze

Hi,
I need to delete subsequent rows, but i have to address the starting and the
end points by referring two cells.

I mean i dont want to use this:
Rows("2:5").Delete
But use this(something like this):
?? Rows( & Cells(1,2):Cells(1,3) & ).Delete ??

Can you please help? I couldn't find something like that in help pages.
 
Hi,
try something like:
Range(Cells(1,2) , Cells(1,3) ).EntireRow.Delete
 
I'm guessing you are looking for something like this...

Range(Cells(2, 1).Row & ":" & Cells(5, 1).Row).Delete

Note that your original Cell references were both using Row 1 (1st argument
in Cells) and changing the Column (2nd argument in Cells); the above
reverses them so the correct rows are being deleted.

Rick
 
another few to delete rows 2:5 (4 total rows)

Rows(2 & ":" & 5).Delete
or
rows(2).resize(4).delete
or
You can use this kind of syntax when you know the top and bottom rows to delete:
rows(2).resize(5-2+1).delete
like:
Dim TopRow as long
Dim BotRow as long
toprow = 2
botrow = 5
rows(toprow).resize(botrow-toprow+1).delete
 

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

Back
Top