I am trying to use the code below to eliminate data in a spreadsheet based on certain criteria. I have been able to get this to work with text fields just fine, but now I am running into an issue with numbers. I am trying to get this code to delete rows if they have the word "unknown" in column C and if the value in column B is greater than 900 hours (999:00:00), the numbers in this column are formatted as [hhh]:mm:ss. What should I tweak to make this work?
![]()
Sub DeleteRows() Dim Last_Row As Long Dim iLoop As Long For iLoop = Last_Row To 1 Step -1 If (Trim(ActiveSheet.Cells(iLoop, 2).Value) > "900") And (Trim(ActiveSheet.Cells(iLoop, 3).Value) = "Unknown") Then ActiveSheet.Cells(iLoop, 3).EntireRow.Delete End If Next iLoop End Sub
Bookmarks