Modification of Part Numbers

T

Tiziano

I would like to add the string "1212" (no quotes)
to some part numbers.

Essentially, I have two versions of part numbers
to modify:
xxxxxxx(space)(space)xxxxxxxxxx
or
xxxxxxxxxx(space)xxxxx(space)(space)xxxxxxx

The length of the xxxxxx strings varies and represents
alphanumeric characters that must remain unchanged.

The end result of the modification should be as
follows:
xxxxxxx1212(space)(space)xxxxxxxxxx
or
xxxxxxxxxx1212(space)xxxxx(space)(space)xxxxxxx

Would somebody please suggest how to do it? This is
beyond my knowledge of Excel.

Thanks in advance.
 
D

Don Guillett

this should do it. Use this to test and then change
msgbox
to
c.value=

Sub addnuminstr()
For Each c In Selection
X = InStr(c, " ") - 1
MsgBox Left(c, X) & 1212 & Right(c, Len(c) - X)
Next c
End Sub
 
T

Tiziano

Don,

Following your suggestion, I have created the macro,
but when I try to run it I get an Invalid Procedure
Call Or Argument message.
I have copied and pasted the macro exactly as you
have written it. My Macro Security is set to Medium.
I am using Excel 2000.
Thanks.
----
Tiziano

Don Guillett said:
this should do it. Use this to test and then change
msgbox
to
c.value=

Sub addnuminstr()
For Each c In Selection
X = InStr(c, " ") - 1
Left(c, X) & 1212 & Right(c, Len(c) - X)
Next c
End Sub
 
T

Tiziano

Correction, Don!
Your macro works just fine. The problem is that I have
not described the structure of my part numbers correctly.

I will post my question with more details in a new message.

Thanks for your help.
----
Tiziano

Tiziano said:
Don,

Following your suggestion, I have created the macro,
but when I try to run it I get an Invalid Procedure
Call Or Argument message.
I have copied and pasted the macro exactly as you
have written it. My Macro Security is set to Medium.
I am using Excel 2000.
Thanks.
 

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