S
scott
My Below Sub accepts a string, finds it and deletes the row in which the
string is found. Can someone help me modify it to continue searching through
all cells that contain data and delete any other rows where the string
occurs?
USAGE:
DeleteRowswString("myword")
CODE
Sub DeleteRowwString(ByVal sString As String)
Dim theRange As Range, nCells As Integer, I As Integer
Set theRange = Selection
nCells = theRange.Cells.Count
For I = nCells To 1 Step -1
If theRange.Cells(I).Value = sString Then
theRange.Cells(I).EntireRow.Delete
End If
Next
End Sub
string is found. Can someone help me modify it to continue searching through
all cells that contain data and delete any other rows where the string
occurs?
USAGE:
DeleteRowswString("myword")
CODE
Sub DeleteRowwString(ByVal sString As String)
Dim theRange As Range, nCells As Integer, I As Integer
Set theRange = Selection
nCells = theRange.Cells.Count
For I = nCells To 1 Step -1
If theRange.Cells(I).Value = sString Then
theRange.Cells(I).EntireRow.Delete
End If
Next
End Sub