I've a macro to select in column D all constants and delete them. The macro runs fine whenever there are constants in this column, and is as follow:
However when there are no constant, the macro ends with 'Run-time error 1004.' No cells were found.
How do I modify this macro to stop (or skip to the next macro line) if it does not find any constant, and if it does, delete them (as currently done)?
Code:
Columns("D:D").Select
Selection.SpecialCells(xlCellTypeConstants, 1).Select
Selection.ClearContents
However when there are no constant, the macro ends with 'Run-time error 1004.' No cells were found.
How do I modify this macro to stop (or skip to the next macro line) if it does not find any constant, and if it does, delete them (as currently done)?