Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Delete all but first line

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.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default Delete all but first line

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

In article ,
Danu wrote:

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.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default Delete all but first line

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.
--
Kevin Backmann


"Danu" wrote:

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.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,202
Default Delete all but first line

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


"Danu" wrote in message
...
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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I delete a few words from a line of text? lauras03 Excel Worksheet Functions 3 February 16th 07 07:20 PM
How to delete a line segment? Tom Hayakawa Charts and Charting in Excel 7 November 3rd 06 09:53 AM
way to test line before / after, without !REF if delete? nastech Excel Discussion (Misc queries) 1 June 23rd 06 02:24 PM
Line delete automaticaly Simbad Excel Discussion (Misc queries) 2 September 30th 05 07:39 PM
How do I delete the line between 2 cells and merge them into one . Eric Excel Discussion (Misc queries) 2 April 11th 05 09:44 PM


All times are GMT +1. The time now is 12:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"