G
Guest
How do I Delete Contents of D2 if B2 = "SD". Then continue through every row
in the file?
in the file?
JE McGimpsey said:One way, with a few minor modifications:
Public Sub ClearColumnContents()
Dim rngToSearch As Range
Dim rngCurrent As Range
Dim strFirstAddress As String
With ActiveSheet
Set rngToSearch = .Range("B2:B" & _
.Range("B" & .Rows.Count).End(xlUp).Row)
End With
Set rngCurrent = rngToSearch.Find( _
What:="SD", _
LookIn:=xlValues, _
LookAt:=xlWhole, _
MatchCase:=False)
If Not rngCurrent Is Nothing Then
strFirstAddress = rngCurrent.Address
Do
rngCurrent.Offset(0, 2).ClearContents
Set rngCurrent = rngToSearch.FindNext(rngCurrent)
Loop Until rngCurrent.Address = strFirstAddress
End If
End Sub