View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Partial find and full replace

Public Sub ProcessData()
Const TEST_COLUMN As String = "U" '<=== change to suit
Dim i As Long
Dim iLastRow As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = iLastRow To 1 Step -1
If .Cells(i, TEST_COLUMN).Value Like "abc*" Then
.Cells(i, TEST_COLUMN).Value = ""
End If
Next i

End With

End Sub

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Darin Kramer" wrote in message
...
Hi there,

Im looking for VB that will look in column U for any instance of "abc"
and when it finds it replace the entire cell contents with nothing.

Thus for eg in cell u2 I have a value abc(if,d2-3,z,y) after the macro
runs I need to have the cell be blank. (ie delete the abc and everything
after it..)

abc is always the first three letters in the cell.

Any ideas..?

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***