+ Reply to Thread
Results 1 to 3 of 3

How to I delete all of the rows except the header row from multiple worksheets

  1. #1
    Registered User
    Join Date
    01-25-2012
    Location
    Addison, TX
    MS-Off Ver
    Excel 2010
    Posts
    3

    Post How to I delete all of the rows except the header row from multiple worksheets

    How to I delete all of the rows except the header row from multiple worksheets but not all of the worksheets?

    I really appreciate all of the help that you give me! As you can see, I'm not a VB programmer!

    Thanks!

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: How to I delete all of the rows except the header row from multiple worksheets

    Use this code in a blank module of your file- Press Alt + F11, on the left hand side you will see Microsoft Excel Objects. Right click and select Insert->Module. Copy the code -
    Please Login or Register  to view this content.
    Where i have put "A" & "B", replace it with the sheet names where the rows shouldnt be deleted.

    Incase the number of sheets where the rows are to be deleted are more than the number of sheets where it shouldnt, use the above macro. Just in case the number of sheets where the rows shouldnt be deleted are less, reverse this line - change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    This will save you time in typing out all the sheet names.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: How to I delete all of the rows except the header row from multiple worksheets

    Hello busiessanalyst,

    Welcome to the Forum!

    This macro lets you specify the worksheets not to clear. Since the macro clears the sheet based on the UsedRange property, it does not matter if the header row is in row 1. The macro assumes the header row is the first row used on the worksheet.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1