+ Reply to Thread
Results 1 to 11 of 11

Trouble running delete rows macro for large excel file

  1. #1
    Registered User
    Join Date
    03-07-2014
    Location
    Jackson, MS
    MS-Off Ver
    Excel 2010
    Posts
    8

    Trouble running delete rows macro for large excel file

    I have an excel file converted from a wordperfect file that contains roughly 600,000 lines of data. The data is currently in its raw form in excel ( see attached example). I am trying to run the following macro to delete empty rows and it will not finish. I have let it run for 8+minutes and it sends excel into "not responding" mode. The macro I am using is:

    Please Login or Register  to view this content.

    I have run this macro a smaller test batch of data and it ran pretty quick. Does anyone have advice on how to fix this? Is running macros on 500,000+ rows even possible? After this I have several other macros to run to format the data the way it needs to be.
    Last edited by Leith Ross; 03-12-2014 at 02:23 PM. Reason: Added Code Tags

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

    Re: Trouble running delete rows macro for large excel file

    Hello MSDemocrat,

    This macro deletes blank rows only. Is that what you want to do?
    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!)

  3. #3
    Registered User
    Join Date
    03-07-2014
    Location
    Jackson, MS
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Trouble running delete rows macro for large excel file

    Yes. I thought I was starting with the easy stuff. Then was going to move onto some of the other formatting macros. I am going to end up deleting some other lines but started with empty rows just to see how macros woudl run on such a large file.

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

    Re: Trouble running delete rows macro for large excel file

    Hello MSDemocrat,

    Generally, blank rows are removed to consolidate data into a contiguous range. The problem with the code may be because it is using UsedRange to determine the end of the data. Which column will always have data in it?

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,837

    Re: Trouble running delete rows macro for large excel file

    Assuming that if the row is blank then no column will have data, will this work?
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

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

    Re: Trouble running delete rows macro for large excel file

    Mumps,

    There may be problem using this method with 600,000 rows of data. SpeciallCells has a maximum limit of 8,191 Range Areas. A Range Area is any non contiguous cells within the range limits.

  7. #7
    Registered User
    Join Date
    03-07-2014
    Location
    Jackson, MS
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Trouble running delete rows macro for large excel file

    Yea, I tried running Mumps' macro and excel quit responding after 5 minutes(I let it run for 10). Would it be easier to just run macros for smaller sections like A1:A100000 or do i need to split data up in wordperfect before i bring it into excel?

  8. #8
    Registered User
    Join Date
    03-07-2014
    Location
    Jackson, MS
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Trouble running delete rows macro for large excel file

    Quote Originally Posted by Leith Ross View Post
    Hello MSDemocrat,

    Generally, blank rows are removed to consolidate data into a contiguous range. The problem with the code may be because it is using UsedRange to determine the end of the data. Which column will always have data in it?
    Column A will always have data in it. I was trying to remove the blank rows and get data into a contiguous range to reduce the number of rows for future macros. The end goal is to only keep rows with FEDERAL AID (GRANT) Number, CONTRACT NUMBER, VENDOR, ACTIVITY, and ACTIVITY TOTAL. I will then reorganize this data into a Vertical Table and have excel lookup data based on contract number and add to the appropriate line.
    Last edited by MSDemocrat; 03-12-2014 at 03:13 PM.

  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,258

    Re: Trouble running delete rows macro for large excel file

    Hello MSDemocrat,

    Sorry the reply took so long. I have been experiencing problems connecting with the forum. Have you had any problems?

    Try this revised macro. It will let you interrupt it if you need to.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    03-07-2014
    Location
    Jackson, MS
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Trouble running delete rows macro for large excel file

    Quote Originally Posted by Leith Ross View Post
    Hello MSDemocrat,

    Sorry the reply took so long. I have been experiencing problems connecting with the forum. Have you had any problems?

    Try this revised macro. It will let you interrupt it if you need to.
    Please Login or Register  to view this content.
    Leith, I was having problems with the forums yesterday afterrnoon as well. I ran into the same issue with this code as with my original code and the other ones supplied in this thread. Excel just gets bogged down and will not respond. This latest code did allow me to exit the macro without having to force close excel and reopen so that was nice I tested your code on a previous version of my project and it works great with 70,000-80,000 lines and removing about 1100 empty rows.

    However, i did find a work around. Instead of deleting emptry rows, I filtered out the empty rows and copy pasted to a new worksheet and that worked well.

    I thank you and Mumps for your assistance and i will be adding this macro to my arsenal for future use.
    Last edited by MSDemocrat; 03-13-2014 at 08:49 AM. Reason: Grammar is hard

  11. #11
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,837

    Re: Trouble running delete rows macro for large excel file

    Hi Leith. I was also having connection problems. Thank you so much for the information about the SpeciallCells method. I will add it to my knowledge base (still learning!!!).
    MSDemocrat, you are very welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Excel only shows small fraction of rows in large file
    By Devourer in forum Excel General
    Replies: 3
    Last Post: 06-26-2013, 09:40 AM
  2. Excel file referencing a large central macro file?
    By alanzero in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-25-2011, 08:29 PM
  3. [SOLVED] Trouble opening large size Excel file 155Mb in Excel 2007
    By pl2c in forum Excel General
    Replies: 2
    Last Post: 07-14-2006, 06:50 PM
  4. Trouble with Filters on a large file
    By Michael in forum Excel General
    Replies: 4
    Last Post: 01-18-2005, 08:06 PM
  5. [SOLVED] How can I open a large Excel file with more than 65536 rows?
    By Ted in forum Excel General
    Replies: 2
    Last Post: 01-13-2005, 06:53 PM

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