+ Reply to Thread
Results 1 to 5 of 5

Macro to DELETE multiple rows

Hybrid View

  1. #1
    Registered User
    Join Date
    03-31-2010
    Location
    Portland, OR
    MS-Off Ver
    Excel 2007
    Posts
    38

    Macro to DELETE multiple rows

    Simple macro needed but couldn't find what I needed in the forums. I have a spreadsheet that has over 500,000 rows of data. (i wont attach for you). All I need is for the macro to:

    Beginning at Row 1, delete row 2 through 1440, and continue until the end. This would essentially leave me what would have been in the 1441st row now in the second row. So on and so forth.

    Pretty simple for sure!

    Anyone??? Help much appreciated!
    Last edited by williampdx; 04-06-2011 at 07:00 PM. Reason: solved

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro to DELETE multiple rows

    Hi,

    How about
    Sheet1.Range("2:1440").EntireRow.Delete
    HTH
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    03-31-2010
    Location
    Portland, OR
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Macro to DELETE multiple rows

    That will not work because it needs to continue down through all 500,000 rows, so that it deletes all rows other than the data contained in the 1st row, 1441st row, 2881st row, etc all the way down. Get it??

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro to DELETE multiple rows

    Hi,

    Rather than using a looping macro why not use a helper column and enter the formula
    =MOD(ROW(),1441)
    in row 1 and copy down 500,000 rows. Now Filter on the helper column for all cells > 1 and finally select all the filtered rows and delete en bloc. You could record a macro to do that if it's something you need to repeat and it will be a lot quicker than a looping macro.

    HTH

  5. #5
    Registered User
    Join Date
    03-31-2010
    Location
    Portland, OR
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Macro to DELETE multiple rows

    You know what, I've been at the computer for too long. That is a much better solution. Not sure why I didn't think of that! Thanks for helping out!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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