Results 1 to 11 of 11

Trouble running delete rows macro for large excel file

Threaded View

  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:

    Sub DeleteEmptyRows()
        Dim LastRow As Long
        Dim r As Long
        Dim Counter As Long
        Application.ScreenUpdating = False
        LastRow = ActiveSheet.UsedRange.Rows.Count + _
          ActiveSheet.UsedRange.Rows(1).Row - 1
        For r = LastRow To 1 Step -1
            If Application.WorksheetFunction.CountA(Rows(r)) = 0 Then
                Rows(r).Delete
                Counter = Counter + 1
            End If
        Next r
        Application.ScreenUpdating = True
        MsgBox Counter & " Empty rows were deleted."
    End Sub

    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

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