+ Reply to Thread
Results 1 to 9 of 9

Excel deletion limitations

  1. #1
    Registered User
    Join Date
    02-26-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Excel deletion limitations

    I have the following code to delete blank lines in my sheet.
    Please Login or Register  to view this content.
    unfortunately I have over 44,000 rows to go through.
    I read that xlCellTypeBlanks has an 8,000 plus limitation

    I have tried a loop but it takes approx. 3 minutes to run through and delete the empty/blank cells.

    I have searched numerous sites for ideas but with little success.

    Does any one have a better idea/method to accomplish this task ???

    Thanks for the help.
    Last edited by Leith Ross; 02-26-2010 at 06:26 PM. Reason: Added Code Tags

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Excel deletion limitations

    s267435,

    Welcome to the Excel Forum.

    Sorry, wrong post.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Excel deletion limitations

    Try this:
    Please Login or Register  to view this content.
    Last edited by shg; 02-26-2010 at 09:39 PM.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Excel deletion limitations

    Quote Originally Posted by s267435
    unfortunately I have over 44,000 rows to go through.
    I read that xlCellTypeBlanks has an 8,000 plus limitation
    Just to add - yes, SpecialCells has a limitation on the number of non-contiguous ranges it can process.

    General advice would be to sort the data by column containing Blanks so as to generate a contiguous range and then apply SpecialCells before reverting sort order based on prior conditions.

    this approach and others are covered at: http://www.rondebruin.nl/specialcells.htm

  5. #5
    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: Excel deletion limitations

    Hello s267435,

    Here is an optimizing macro. This will limit the size of the area to only the rows and columns with data. Only the data is shifted after the blanks are deleted. The cell formatting remains the same. The trials on this macro averaged about 2.8 secs on my machine to shift 12000 rows by 5 columns wide. Your results will be different, but should be quite fast.
    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!)

  6. #6
    Registered User
    Join Date
    02-26-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Excel deletion limitations

    Thank all of you for the responses.

    Shg, I attempted to run your code in my sheet but it is not faster than the current loop I have.

    Leith, I also attempted to run your code but received -
    Error 1004 at this line :
    Set Rng = wks.Range("C1", wks.Cells(Rows.Count, "C").End(xlUp))
    - not sure how you executed it ????

  7. #7
    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: Excel deletion limitations

    Hello s267435,

    I must have posted the uncorrected version of the code. Well, you're in luck because I made some other changes to improve the code. his version is also a little bit faster than before.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    02-26-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Excel deletion limitations

    Leith, thanks for the effort your are putting into this thread.

    However, I still receive an Error 1004 at line:

    Set RngEnd = Wks.Cells(Rows.Count, Rng.Column).End(xlUp)

    currently debugging but other suggestions are welcome.

    Thanks

  9. #9
    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: Excel deletion limitations

    Hello s267435,

    Since I know this code works, something else is wrong. Please attach the workbook so I review it.

+ 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