Delete all but first line

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

Guest

Is there a way to easily delete all the records in a spreadsheet except for
the first line?

I have a spreadsheet with many records which must be updated each day with
new info. I can delete all the records but end up rewriting the column
titles.

Thank you.
 
One way:

Use this macro, attached to a button or keyboard shortcut:

Public Sub ClearSheet
With ActiveSheet
.Rows("2:"&.Rows.Count).Clear
End With
End Sub
 
This macro is a possibility. Change the starting cell of A1 accordingly:

************************************************************
Sub ClearTheWay()

Dim r As Range

Set r = Range("A1").CurrentRegion

r.Range(Cells(2, 1), Cells(r.Rows.Count, _
r.Columns.Count)).Clear

Set r = Nothing

End Sub
************************************************************

Press Alt + F11, click INSERT on the menu and select MODULE. You can copy
and paste the macro code verbatim, excluding the lines of asterisks.
 
Manually, you could click the "2" in the row header to select the entire row
2 and then follow that up by keying in

Ctrl+Shift+{END}+{DOWN ARROW}

and follow that by pressing {DELETE}.

Rick
 
Back
Top