Deleting "variable" areas in a worksheet

A

adidas2121

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
 
P

pfsardella

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
 
C

chris

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
 
M

mudraker

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
 
Top