Paste/add text to beginning of multiple fields in Excel

S

stonelinton

I have a table setup already, but realized that on field requires I add
'CEP' to the beginning of the values in 1444 fields (same column). I
don't want to go through field by field and paste, is there a way to
merge values or join fields . . . etc?
 
N

Nikos Yannacopoulos

Assuming your numeric data is in A2:A1445, put this formula in any empty
column in row 2:

="CEP" & A2

Then copy down; next, copy this new column and paste special > values
over the original data in A2:A1445. Finally, delete the temporary column
and you're done.

HTH,
Nikos
 
C

CLR

For numbers in column A, this macro will do it.....

Sub ConcatenateMe()
Dim lastrow As Long, r As Long
Dim cv As String
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For r = lastrow To 1 Step -1
If Cells(r, "A") <> "" Then
Cells(r, "A").Select
cv = Selection.Value
End If
With ActiveCell
.Value = "CEP" & cv
End With
Next r
End Sub

Vaya con Dios,
Chuck, CABGx3
 
S

stonelinton

This worked . . . once. I had to add ( ) around formula, but it won't
work again. It just shows up as text in the field. Any suggestions?
Thanks.
 
N

Nikos Yannacopoulos

...It just shows up as text in the field.
Probably because the cells were already formatted as Text! Change the
cell formatting to General and hit F9 to recalculate. The brackets
shouldn't be required.

HTH,
Nikos
 
Top