Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The sub below is used to check the D column for values with a negative sign. If
the negative sign exists I want to delete the entire row. When there are no records with a negative sign in the D column, it returns a run-time error 1004 - No cells were found. How do I rewrite this procedure so that the error is not returned when no cells with a negative are found but still deletes rows when a value has a negative sign? I understand that some Range object methods require that the range contain data. If the range does not contain data, the method fails. But what would be the proper way around this? Sub CleanCancelledChks() Dim r As Range With ActiveSheet Set r = .Range(.Range("D2"), .Range("D" & _ Rows.Count).End(xlUp)) .Columns("D:D").AutoFilter Field:=1, Criteria1:="=*-*" Set r = r.SpecialCells(xlCellTypeVisible) .AutoFilterMode = False r.EntireRow.Delete End With End Sub Thank you in advance for any advice. mark |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Compile error: Method or data member not found | Excel Worksheet Functions | |||
Return all values found for criteria | Excel Discussion (Misc queries) | |||
If search criteria is not found, then goto Repeat? | Excel Programming | |||
Go to record found by Criteria in Data Form | Excel Programming |