Deleting "variable" areas in a worksheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all
Using xldown I can locate the variable last row number but how do I delete the next "n" rows from the variable last ro
Ex: One time the last row may be row 200.
I need to delete the next "n" rows ... lets say 201 to 210
Ex: One time the last row may be row 150
I need to delete the next "n" rows ... lets say 150 to 155

Thanks in advance
Joe
 
Joe,

Here's one way.

Sub DeleteSomeRows()
Dim lngRD As Long
Dim rngLast As Range
lngRD = 3000
Set rngLast = ActiveCell.End(xlDown).Offset(1, 0)
Range(rngLast, rngLast.Offset(lngRD, 0)).EntireRow.Delete
End Sub

HTH
Paul
 
Rows(LastRow).Offset(1).Resize(N).EntireRow.Delete

....Why would you need to delete Empty Rows?...

----- adidas2121 wrote: -----

Hello all,
Using xldown I can locate the variable last row number but how do I delete the next "n" rows from the variable last row
Ex: One time the last row may be row 200.
I need to delete the next "n" rows ... lets say 201 to 210
Ex: One time the last row may be row 150.
I need to delete the next "n" rows ... lets say 150 to 155.

Thanks in advance,
Joe
 
As you have not indicating on how you will be calculating how many row
nRows will be I can not give you exact code to solve your problem




nrow = 10
lastrow = Range("A1").End(xlDown).Row
Rows(lastrow + 1).Resize(nrow).Delet
 

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