Find Last cell used & delete 6 rows below that

berty2000

Board Regular
Joined
Mar 29, 2011
Messages
71
Using excel 2003
Trying to figure out how to search down a list of cells in column B.

Find the last cell with data in then delete the next 10 rows below this selection

so far


Sub Cleanup()

'finds the last active cell in range + 1 cell
ActiveSheet.Range("B500").End(xlUp).Offset(1, 0).Select

ActiveCell.Offset(10).Select
End Sub

kind of lost how to do the last bit ?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Try

Code:
Sub Cleanup()
Range("B" & Rows.Count).End(xlUp).Offset(1).Resize(10).EntireRow.Delete
End Sub
 
Upvote 0
Sub Cleanup()

'finds the last active cell in range + 1 cell
ActiveSheet.Range("B500").End(xlUp).Offset(1, 0).Select

Dim xlong As Long
Range(Cells(Rows.Count, 2).End(xlUp).Offset(1), _
Cells(Rows.Count, 2)).EntireRow.Delete
xlong = ActiveSheet.UsedRange.Rows.Count
End Sub

Kind of got it too work but it deletes all rows below the selection not last 6
 
Upvote 0
VoG's code is right, but why are you trying to delete empty rows?

What benefit will this give you??

:confused:
 
Upvote 0
Thank you Vog that work exactly how i wanted :cool:

obiron there is more data lower down in other rows just need to delete a couple of rows below the data in B column to bring other data back up if that makes sense ! It does not as im writing it :ROFLMAO:
 
Upvote 0
Thank you that worked just right and in just one line ! this VB code thingy in excel is really good, never even knew it existed until stumbling upon this site.
 
Upvote 0

Forum statistics

Threads
1,203,379
Messages
6,055,094
Members
444,761
Latest member
lneuberger

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top