large size spreadsheet - delete the blank stuff

BrutalLogiC

Active Member
Joined
Feb 26, 2006
Messages
267
Office Version
  1. 2016
Platform
  1. Windows
hey I'm struggling to use a spreadsheet which is 75mb so trying to cut down the amount of blank/empty rows columns

on a few of the sheets there's 50k rows with data but then on about a dozen other sheets there's "only" 10k rows with data and 40k empty rows, the scroll bars are very small

is there an easy way to delete? I've not come up with any method that works well

when I try copy the sheet into a new workbook it seems to copy all the blank as well so maybe I can select all the cells with data easily to do this rather than scrolling through 50k of lines?

tyvm
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
I've started just copying the individual sheets into a new workbook, slow but painful, seems to be working
 
Upvote 0
Hello BrutalLogic,

Following is something I did for another Poster on another forum a couple of years ago. It was for a large data set over four sheets with many blank rows also.


Code:
Sub DeleteStuff()

    Dim ws As Worksheet
    
Application.ScreenUpdating = False

For Each ws In Worksheets
ws.Range("A2", ws.Range("H" & ws.Rows.Count).End(xlUp)).Sort ws.[A2], 1

With ws.Range("A1", ws.Range("A" & ws.Rows.Count).End(xlUp))
        .AutoFilter 1, ""
        .Offset(1).EntireRow.Delete
        .AutoFilter
        End With
Next ws

Application.ScreenUpdating = True

End Sub

The key to helping it speed up was to sort all the data by Column A which ended up putting all the blank rows at the bottom of each data set in each sheet.
The data set in each sheet spanned Columns A:H and some 100K rows.

I'm not sure how effective it could be for your situation but there's no harm in trying!

Following is a link to the sample the Poster supplied (all with dummy data). Click on the "RUN" button to see it work.

http://ge.tt/1AGAbdp2

Test it in a copy of your work book also.

I hope that this helps.

Cheerio,
vcoolio.
 
Last edited:
Upvote 0
Another option, if your blanks are below the data
Code:
Sub delExcess()
   Dim Ws As Worksheet
   For Each Ws In Worksheets
      Ws.Rows(Ws.Cells.Find("*", , xlValues, , , xlPrevious, , , False).Row & ":1048576").Delete
   Next Ws
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,391
Messages
6,119,244
Members
448,879
Latest member
VanGirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top