Change first character in a cell

H

houghi

I have a list of +2000 phonenumbers and they are in the format of
012345678 but must become 3212345678, so the first 0 needs to become 32

I searched, but was unable to find a solution. Any idea?

houghi
 
T

Toppers

In a "helper" column put:

="32"& RIGHT(A1,LEN(A1)-1)

Copy down.

Copy & Paste Special=>Values to remove" formula.
 
M

Mike H

A macro perhaps:-

Sub changefirst()
Dim rcell As Range
Dim Myrange As Range
Dim maxval As Variant
Set Myrange = Range("A1:A100") '<Change to suit
newprefix = "32"
For Each rcell In Myrange
newvalue = newprefix & Mid(rcell.Value, 2, 99)
rcell.Value = newvalue
Next
End Sub

Mike
 
H

houghi

This works well enough, thanks.

Mike said:
A macro perhaps:-

Sub changefirst()
Dim rcell As Range
Dim Myrange As Range
Dim maxval As Variant
Set Myrange = Range("A1:A100") '<Change to suit
newprefix = "32"
For Each rcell In Myrange
newvalue = newprefix & Mid(rcell.Value, 2, 99)
rcell.Value = newvalue
Next
End Sub

Mike


houghi
 
G

Gord Dibben

Nothing wrong with Toppers' formula.

Apparently you typed or copied incorrectly.

But I see from other post you got the job done.


Gord Dibben MS Excel MVP
 
Top