Macro - Deleting Rows

Matt_Chelmsford

Board Regular
Joined
Jan 31, 2009
Messages
160
Good afternoon everyone,

It looks like it's going to be very nice this weekend in the South east/London area. Just typical, why could it not have been nice last weekend when I saw Springsteen?

ANyway here is my problem

cell H58 is the start of my data (ignoring headings) and in column H I have sequential numbering, so H58 is 1.

The data range goes over to column M.

I have successfully put in a macro where the user just hits the button and it adds a line in. For example if there are 12 rows then it can add 13, 14, 15,etc just by hitting the button.

I need a macro that does the opposite where it goes down to the last number and deletes the cells H:M.

Grateful for any help!

kind regards

Matthew
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
You can attach this to a button.

Code:
Sub delLast()
Dim sh As Worksheet, lr As Long
Set sh = Sheets(1) 'Edit sheet name
lr = sh.Cells(Rows.Count, "H").End(xlUp).Row
Range("H" & lr).Resize(1, 6).Delete
End Sub
Code:
 
Upvote 0
or try this:

Code:
Sub HM()
    Dim LRw
    LRw = Range("H" & Rows.Count).End(xlUp).Row
    Range("H" & LRw & ":M" & LRw).Delete
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,789
Messages
6,121,590
Members
449,039
Latest member
Arbind kumar

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