Simple VB Help

Soldato
Joined
1 Dec 2004
Posts
22,773
Location
S.Wales
In VB, using excel, how do i say (if a cell in a particular row is not red, delete the row)..

Here is the code so far...

Code:
Sub dazzasSearch()
    Dim lCell As Range
    Dim x As Integer
    x = 0
    For Each lCell In Range("L1:L6210")
        x = x + 1
        If Not (IsEmpty(lCell)) Then
            If InStr(lCell.Value, "Landscaping") > 0 Then
                lCell.Interior.ColorIndex = 3
            End If
            If InStr(lCell.Value, "Grounds Maintenance") > 0 Then
                lCell.Interior.ColorIndex = 3
            End If
            If InStr(lCell.Value, "Soft Landscaping") > 0 Then
                lCell.Interior.ColorIndex = 3
            End If
            If InStr(lCell.Value, "Tree Surgery") > 0 Then
                lCell.Interior.ColorIndex = 3
                End If
            If InStr(lCell.Value, "General Waste Disposal") > 0 Then
                lCell.Interior.ColorIndex = 3
            End If
            
               
         
         
        End If
    
    Next
End Sub

i have a macro button with this code which shows all cells in red which contain a certain value, all other cells are not red, if they are not red i want the macro to delete the whole row that the cell belongs too...
 
Back
Top Bottom