I'm trying to go through a range of cells which contain strings in an excel spreadsheet. If a particular cell contains a specific string, I'd like to replace the entire cell with that same string. I typed out what I think should work, and yet I'm getting nothing. Any help would be appreciated!
Sub Supportclean()
Dim c As Range
Dim celltext As String
For Each c In Range("E:E")
If InStr(1, celltext, "horse") > 0 Then
Range(c) = "horse"
End If
Next c
End Sub
Thanks so much!
You can do the whole column at once no need for a loop:
Sub supportclean()
Range("E:E").Replace "*horse*", "horse"
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With