Results 1 to 8 of 8

Delete Rows Multiple Criteria w/Numbers

Threaded View

  1. #1
    Registered User
    Join Date
    12-05-2007
    Location
    Oklahoma
    MS-Off Ver
    2003, 2007
    Posts
    22

    Delete Rows Multiple Criteria w/Numbers

    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
    Last edited by eriknokc; 12-23-2009 at 07:26 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1