![]() |
Delete Empty Rows
Trying to write a macro that will read each row and if there is no dat - delete it. Thought I could use the EntireRow.delete but not havin any luck with it. (Excel 2002) Now if only I could get the users to stop entering the blank rows... Any help is appreciated. -christia -- christia ----------------------------------------------------------------------- christian's Profile: http://www.excelforum.com/member.php...fo&userid=1436 View this thread: http://www.excelforum.com/showthread.php?threadid=26175 |
Delete Empty Rows
Hi Christian,
For rows with blanks in column A, Try: Range("A1:A100").SpecialCells(xlCellTypeBlanks). _ EntireRow.Delete Change the range to suit. --- Regards, Norman "christian" wrote in message ... Trying to write a macro that will read each row and if there is no data - delete it. Thought I could use the EntireRow.delete but not having any luck with it. (Excel 2002) Now if only I could get the users to stop entering the blank rows... Any help is appreciated. -christian -- christian ------------------------------------------------------------------------ christian's Profile: http://www.excelforum.com/member.php...o&userid=14361 View this thread: http://www.excelforum.com/showthread...hreadid=261759 |
Delete Empty Rows
Hi
see: http://www.cpearson.com/excel/deleti...eleteBlankRows -- Regards Frank Kabel Frankfurt, Germany christian wrote: Trying to write a macro that will read each row and if there is no data - delete it. Thought I could use the EntireRow.delete but not having any luck with it. (Excel 2002) Now if only I could get the users to stop entering the blank rows... Any help is appreciated. -christian |
Delete Empty Rows
Hi Christian
Do you want to check one column or more ? Post back if you want to check more columns If you use Norman's example add the following line On Error Resume Next 'In case there are no blank rows Range("A1:A100").SpecialCells(xlCellTypeBlanks).En tireRow.Delete On Error GoTo 0 If you do this for a whole column be carfull with the SpecialCells limit http://support.microsoft.com/default...b;en-us;832293 David have a example om his site to avoid problems http://www.mvps.org/dmcritchie/excel/delempty.htm The sub is named del_COLA_empty() -- Regards Ron de Bruin http://www.rondebruin.nl "Norman Jones" wrote in message ... Hi Christian, For rows with blanks in column A, Try: Range("A1:A100").SpecialCells(xlCellTypeBlanks). _ EntireRow.Delete Change the range to suit. --- Regards, Norman "christian" wrote in message ... Trying to write a macro that will read each row and if there is no data - delete it. Thought I could use the EntireRow.delete but not having any luck with it. (Excel 2002) Now if only I could get the users to stop entering the blank rows... Any help is appreciated. -christian -- christian ------------------------------------------------------------------------ christian's Profile: http://www.excelforum.com/member.php...o&userid=14361 View this thread: http://www.excelforum.com/showthread...hreadid=261759 |
Delete Empty Rows
lastrow = cells(rows.count,1).End(xlup).row
for i = lastrow to 1 step -1 if Application.CountA(rows(i)) = 0 then rows(i).Delete end if Next -- Regards, Tom Ogilvy "christian" wrote in message ... Trying to write a macro that will read each row and if there is no data - delete it. Thought I could use the EntireRow.delete but not having any luck with it. (Excel 2002) Now if only I could get the users to stop entering the blank rows... Any help is appreciated. -christian -- christian ------------------------------------------------------------------------ christian's Profile: http://www.excelforum.com/member.php...o&userid=14361 View this thread: http://www.excelforum.com/showthread...hreadid=261759 |
All times are GMT +1. The time now is 06:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com