Remove Blank Cells in a Selection
I have a range selected in a Column and am trying to delete the Blan cells out. The following code works if there are blank cells in th range, but if there are not it gives an error. Selection.SpecialCells(xlCellTypeBlanks).Delete Shift:=xlUp Is there a way of doing it so it doesn't give an error, or should just do On Error Resume Next for this section of the macro -- Krage ----------------------------------------------------------------------- Krager's Profile: http://www.excelforum.com/member.php...fo&userid=2093 View this thread: http://www.excelforum.com/showthread.php?threadid=40170 |
Remove Blank Cells in a Selection
Krager Wrote: I have a range selected in a Column and am trying to delete the Blank cells out. The following code works if there are blank cells in the range, but if there are not it gives an error. Selection.SpecialCells(xlCellTypeBlanks).Delete Shift:=xlUp Is there a way of doing it so it doesn't give an error, or should I just do On Error Resume Next for this section of the macro? On Error Resume Next Selection.SpecialCells(xlCellTypeBlanks).Delete Shift:=xlUp On Error GoTo 0 -- Bob Phillips ------------------------------------------------------------------------ Bob Phillips's Profile: http://www.excelforum.com/member.php...o&userid=26952 View this thread: http://www.excelforum.com/showthread...hreadid=401709 |
Remove Blank Cells in a Selection
Thanks, works perfectly -- Krager ------------------------------------------------------------------------ Krager's Profile: http://www.excelforum.com/member.php...o&userid=20936 View this thread: http://www.excelforum.com/showthread...hreadid=401709 |
All times are GMT +1. The time now is 01:29 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com