FIND Beginning of field and add C to end of the field

G

Guest

Hi,
I have a list of parts in Column A. I want to do a macro to find lets say
beginning 4 characters of the part and when it find to add letter C at end of
the part
Example.
TESTAB
XZZZTT
TESTPART

So lets say I'm searching for TEST, so my end result I'm looking is the
following
TESTC
TESTPARTC
Would appreciate any help
Thank you,
Juan
 
G

Guest

Try following macro

Sub SearchTest()
For i = 1 To 5 ' 5 = Last Rownumber to search
If Left(Cells(i, 1).Value, 4) = "Test" Then
Cells(i, 1).Value = Cells(i, 1).Value & "C"
End If
Next i
End Sub


Replace 5 with the last row aou want to look in.

Regards
reklamo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top