A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

extra empty rows in Excel file



 
 
Thread Tools Display Modes
  #1  
Old June 16th, 2004, 01:39 PM
Linda
external usenet poster
 
Posts: n/a
Default extra empty rows in Excel file

My Excel file has 950 rows of data. Somehow, I now have
over 58,000 rows of empty cells; the file size has grown
from 500kb to 2100 kb. How do I delete the empty rows?
  #2  
Old June 16th, 2004, 02:10 PM
Berend Botje
external usenet poster
 
Posts: n/a
Default extra empty rows in Excel file

Using vba you can try something like:

Sub DeleteRows

Dim Row as integer
Dim Col as integer
Dim CountingValue as integer

For row = 1 to 60000
Col = 1
For col = 1 to 10
if len(cells(row,col).value) 0 then
CountingValue = CountingValue+1
goto nextRow
end if
Next Col
NextRow:
if Countingvalue 0 then
Cells(row,1).entirerow.delete
Countingvalue = 0
end if
Next Row

end sub


The script checks the first 10 cells of each row. If all of them are
empty, the row is presumed empty and is deleted. If one or more of them
contain any data, the row is not deleted.


---
Message posted from http://www.ExcelForum.com/

  #3  
Old June 16th, 2004, 02:30 PM
Andy B
external usenet poster
 
Posts: n/a
Default extra empty rows in Excel file

Hi

Have a look he
http://www.contextures.com/xlfaqApp.html#Unused

--
Andy.


"Linda" wrote in message
...
My Excel file has 950 rows of data. Somehow, I now have
over 58,000 rows of empty cells; the file size has grown
from 500kb to 2100 kb. How do I delete the empty rows?



  #4  
Old June 16th, 2004, 04:48 PM
Linda
external usenet poster
 
Posts: n/a
Default extra empty rows in Excel file


-----Original Message-----
Using vba you can try something like:

Sub DeleteRows

Dim Row as integer
Dim Col as integer
Dim CountingValue as integer

For row = 1 to 60000
Col = 1
For col = 1 to 10
if len(cells(row,col).value) 0 then
CountingValue = CountingValue+1
goto nextRow
end if
Next Col
NextRow:
if Countingvalue 0 then
Cells(row,1).entirerow.delete
Countingvalue = 0
end if
Next Row

end sub


The script checks the first 10 cells of each row. If all

of them are
empty, the row is presumed empty and is deleted. If one

or more of them
contain any data, the row is not deleted.


---
Message posted from http://www.ExcelForum.com/

.



THanks; I'm not familiar with using VBA. Is there another
method?
  #5  
Old June 16th, 2004, 10:55 PM
Gord Dibben
external usenet poster
 
Posts: n/a
Default extra empty rows in Excel file

Linda

Select a sheet.

Hit CRTL + END keys.

Where does this take you?

If far below and to right of your real data range, select all rows below your
data and EditDelete.

Do the same for columns to the right.

Follow these steps for each sheet.

NOW IMPORTANT STEP.....Save your workbook. Close and re-open. Your used
range should now be much smaller.

Gord Dibben Excel MVP

On Wed, 16 Jun 2004 08:48:11 -0700, "Linda"
wrote:

THanks; I'm not familiar with using VBA. Is there another
method?


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:30 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.