Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Good morning,
I ran into a problem yesterday with a macro I have used for a few months without incident. I am receiving the following run-time error: ---------------- Run-time error '1004': No cells were found. ---------------- My macro is supposed to look for blank cells in a given range, find them, and deletes the entire row(s) found to contain the blank cells. The error is now occuring because, for the first time, no blank cells exist, and I failed to consider this possibility. Here is the part of macro that fails when no blank cells are found. ----------------- 'delete rows with blank cells Columns("A:A").Select Selection.SpecialCells(xlCellTypeBlanks).Select Selection.EntireRow.Delete ----------------- How can I cope with cases where no blank cells in a given range exist and then simply bypass this part of the macro? A conditional statement, I assume. Any thoughts? As always, thanks much for any help offered. Best Regards, Joseph |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
one simple way
On Error resume Next Columns("A:A").SpecialCells(xlCellTypeBlanks).Sele ct If Err.Number = 0 Then Selection.EntireRow.Delete End If "Joseph Spain" wrote in message news:P5vae.402$Bb.97@okepread06... Good morning, I ran into a problem yesterday with a macro I have used for a few months without incident. I am receiving the following run-time error: ---------------- Run-time error '1004': No cells were found. ---------------- My macro is supposed to look for blank cells in a given range, find them, and deletes the entire row(s) found to contain the blank cells. The error is now occuring because, for the first time, no blank cells exist, and I failed to consider this possibility. Here is the part of macro that fails when no blank cells are found. ----------------- 'delete rows with blank cells Columns("A:A").Select Selection.SpecialCells(xlCellTypeBlanks).Select Selection.EntireRow.Delete ----------------- How can I cope with cases where no blank cells in a given range exist and then simply bypass this part of the macro? A conditional statement, I assume. Any thoughts? As always, thanks much for any help offered. Best Regards, Joseph |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Patrick Molloy" wrote:
one simple way On Error resume Next Columns("A:A").SpecialCells(xlCellTypeBlanks).Sele ct If Err.Number = 0 Then Selection.EntireRow.Delete End If Thanks much, Patrick. That works perfectly. Best regards, Joseph |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2003 Template Help Task Pane | Excel Discussion (Misc queries) | |||
Task Pane - Excel 2003 | Excel Discussion (Misc queries) | |||
Task Manager and Excel 2003 | Excel Discussion (Misc queries) | |||
Excel 2003 File, New Task Pane | Excel Programming | |||
excel 2003 Task Pane programming | Excel Programming |