+ Reply to Thread
Results 1 to 3 of 3

Auto Remove Rows in List

Hybrid View

  1. #1
    Registered User
    Join Date
    06-28-2007
    MS-Off Ver
    MS365 (Mac) Version 16.68 (22121100)
    Posts
    41

    Auto Remove Rows in List

    I need to figure out how to take columns of information that are produced based on formulas and return other columns that take out the blank rows so all information is consecutive.

    See attached. First columns have blank rows. 2nd columns have desired result.

    Thank you
    Attached Files Attached Files

  2. #2
    Forum Contributor day92's Avatar
    Join Date
    04-20-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 360
    Posts
    600

    Re: Auto Remove Rows in List

    You can run this macro to delete empty rows. Let me know if this works for you or if you need me to modify it.

    [code]
    Sub DeleteEmptyRowsAndColumns()
    LastRow = ActiveSheet.UsedRange.Row - 1 + _
    ActiveSheet.UsedRange.Rows.Count
    Application. ScreenUpdating = False
    For r = LastRow To 1 Step -1
    If Application. CountA(Rows(r)) = 0 Then Rows(r).Delete
    Next r

    LastColumn = ActiveSheet.UsedRange.Column - 1 + _
    ActiveSheet.UsedRange.Columns.Count
    Application.ScreenUpdating = False
    For c = LastColumn To 1 Step -1
    If Application.CountA(Columns(c)) = 0 Then Columns(c).Delete
    Next c
    End Sub
    [\code]

  3. #3
    Forum Contributor day92's Avatar
    Join Date
    04-20-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 360
    Posts
    600

    Re: Auto Remove Rows in List

    
    Sub DeleteEmptyRowsAndColumns() 
        LastRow = ActiveSheet.UsedRange.Row - 1 + _ 
        ActiveSheet.UsedRange.Rows.Count 
        Application. ScreenUpdating = False 
        For r = LastRow To 1  Step -1 
            If Application. CountA(Rows(r)) = 0 Then Rows(r).Delete 
        Next r 
         
        LastColumn = ActiveSheet.UsedRange.Column - 1 + _ 
        ActiveSheet.UsedRange.Columns.Count 
        Application.ScreenUpdating = False 
        For c = LastColumn To 1 Step -1 
            If Application.CountA(Columns(c)) = 0 Then Columns(c).Delete 
        Next c 
    End Sub

+ 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