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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|