Macro to delete rows
Hi Kirk,
Kirk P. wrote: I was hoping to create a VBA function that would identify empty or blank cells within a range, and then delete the row associated with that empty or blank cell. try this: Range("A1:A50").SpecialCells(xlCellTypeBlanks).Ent ireRow.Delete -- Regards Melanie Breden - Microsoft MVP für Excel - http://excel.codebooks.de (Das Excel-VBA Codebook) |
Macro to delete rows
I like to add this
Use this instead to avoid a error when there are no blanks Sub test() On Error Resume Next Range("A1:A50").SpecialCells(xlCellTypeBlanks).Ent ireRow.Delete On Error GoTo 0 End Sub Also this code can be a problem Read this KB http://support.microsoft.com/?kbid=832293 -- Regards Ron de Bruin http://www.rondebruin.nl "Melanie Breden" wrote in message ... Hi Kirk, Kirk P. wrote: I was hoping to create a VBA function that would identify empty or blank cells within a range, and then delete the row associated with that empty or blank cell. try this: Range("A1:A50").SpecialCells(xlCellTypeBlanks).Ent ireRow.Delete -- Regards Melanie Breden - Microsoft MVP für Excel - http://excel.codebooks.de (Das Excel-VBA Codebook) |
Macro to delete rows
Ron de Bruin wrote:
I like to add this Use this instead to avoid a error when there are no blanks Sub test() On Error Resume Next Range("A1:A50").SpecialCells(xlCellTypeBlanks).Ent ireRow.Delete On Error GoTo 0 End Sub Ron thanks you for the addition :-) -- Regards Melanie Breden - Microsoft MVP für Excel - http://excel.codebooks.de (Das Excel-VBA Codebook) |
All times are GMT +1. The time now is 04:41 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com