ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FIND Beginning of field and add C to end of the field (https://www.excelbanter.com/excel-programming/395667-find-beginning-field-add-c-end-field.html)

Juan

FIND Beginning of field and add C to end of the field
 
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

reklamo

FIND Beginning of field and add C to end of the field
 
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


"Juan" wrote:

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


Juan

FIND Beginning of field and add C to end of the field
 
Hello Reklamo,
thanks alot for your help. This works :)

Have a great weekend.

Juan

"reklamo" wrote:

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


"Juan" wrote:

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



All times are GMT +1. The time now is 07:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com