how to delete a row

  • Thread starter Thread starter Newbie
  • Start date Start date
N

Newbie

Hi,

I want to be able to - on the click of a button - find the last row in a
list and delete the complete line.

How do I do this?

Thanks
 
Hi
if your list is in column A (that is column A indicates the last row).
Try the following macro
Sub delete_last_row()
Dim rng As Range
Set rng = Cells(Rows.Count, 1).End(xlUp) 'change the 1
according to your column with data
rng.EntireRow.Delete
End Sub

Assign this macro to a button/toolbar

Frank
 
Thanks works a treat

Is it possible for you to explain the syntax or tell me where I can find out
about it

Thanks again
 
there is no reason to retrieve the row number and feed it to the rows
object. Just use what you find directly

cells(rows.count,1).End(xlup).EntireRow.Delete

go to the bottom of the spreadsheet. Select cell A65536. Hit the end
button, then the up arrow, then do Edit=> delete and select Entire Row

That is pretty much it.
 
Back
Top