UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Delete All Empty Rows Without Resorting    
 
   
4fit
post Jan 13 2005, 04:27 PM
Post#1



Posts: 434
Joined: 7-January 05
From: Graham, NC


Ever need to delete all of the empty rows in a spreadsheet WITHOUT resorting it? Here's some code to do just that:
CODE
Sub DeleteEmptyRows()
    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
    
End Sub
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    13th December 2017 - 12:31 AM