create simple macro

N

noraisens

I have one column of 500 numbers similar to this "cc03052" they all
start with cc I need the macro to add "05" into the number at a
specific point then to go the next.

before after
cc03052 cc0305052
cc04130 cc0412050

can anyone help me
 
N

Nick Hodge

Can you not use a formula?

If the old values are in column A in B1 enter

=LEFT(A1,6)&"05"&RIGHT(A1,1)

And copy down. This presumes they (the old value) are all the same length.
If not paste back

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
[email protected]
 
N

noraisens

Yes, the second post was a mistake.

I have 6 columns with information.
the second column has an id number with 2 letters and 5 numbers (ie:
ccxxxxx). example: cc14081.
I would like to make this id number bigger by adding 2 numbers in a
specific place in the id number (ie: ccxxxx05x). example: cc1408051.

I took the column of numbers and placed it in a new worksheet in column
a

i took the formula =LEFT(A1,6)&"05"&RIGHT(A1,1) and placed it in column
b.

I then copied it down and It worked. Thank you.

can I recap what was done.

LEFT(A1,6) in cell A1 go from the left 6 spaces
&"05"& insert 05
RIGHT(A1,1) in cell A1 go from the right 1 space and leave the digit in
place.

Is this correct?

Is it possible to make this so that you can actually take the number
out and replace it. as long as the column was identified?

thanks,
Ron
 
N

Nick Hodge

Ron

Left is taking the data from left of an input cell (A1) and then taking the
first 'x' characters. Right doe the same from the right. The other one you
have that could certainly be used to replace the number is MID

=MID(CellRef,StartCharacter,NoCharactersToTakeFromStartCharacter)

If that makes sense

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
[email protected]
 
Top