+ Reply to Thread
Results 1 to 3 of 3

Delete entire row on condition

Hybrid View

  1. #1
    Registered User
    Join Date
    07-14-2008
    Location
    Sacramento
    Posts
    11

    Question Delete entire row on condition

    I'm not a programmer so this is probably simple.

    I need to delete the entire row if the following conditions are met:
    - Cell C and the row is blank or has the "no info" text in it and
    - Cell D is blank

    I use excel 2003

    Thanks
    bouitac

  2. #2
    Forum Contributor
    Join Date
    05-21-2004
    Location
    UK
    Posts
    136

    Re: Delete entire row on condition

    Public Sub ProcessData2()
    Const TEST_COLUMN As String = "A"    '<=== change to suit
    Dim i As Long
    Dim LastRow As Long
    
        With Application
            
            .ScreenUpdating = False
            .Calculation = xlCalculationManual
        End With
        
        With ActiveSheet
            
            LastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
            For i = LastRow To 1 Step -1
            
                If (.Cells(i, "C").Value = "" Or .Cells(i, "C").Value = "no info") And _
                    .Cells(i, "D").Value = "" Then
                
                    .Rows(i).Delete
                End If
            Next i
            
        End With
        
        With Application
            
            .Calculation = xlCalculationAutomatic
            .ScreenUpdating = True
        End With
        
    End Sub

  3. #3
    Registered User
    Join Date
    07-14-2008
    Location
    Sacramento
    Posts
    11

    Re: Delete entire row on condition

    Thank you very much that worked great!

    Bouitac

+ Reply to Thread

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