Add characters in front or behind a cell
If you want to add the text in place try this macro.
Sub Add_Text()
Dim Cell As Range
Dim moretext As String
Dim thisrng As Range
On Error GoTo endit
whichside = InputBox("Left = 1 or Right =2")
Set thisrng = Range(ActiveCell.Address & "," & Selection.Address) _
.SpecialCells(xlCellTypeConstants, xlTextValues)
moretext = InputBox("Enter your Text")
If whichside = 1 Then
For Each Cell In thisrng
Cell.Value = moretext & Cell.Value
Next
Else
For Each Cell In thisrng
Cell.Value = Cell.Value & moretext
Next
End If
Exit Sub
endit:
MsgBox "only formulas in range"
End Sub
Gord Dibben MS Excel MVP
On Sun, 26 Oct 2008 11:36:01 -0700, ShaneDevenshire
wrote:
Hi,
The suggestions you have recieved are correct, but if you want to add
different characters to each cell then enter the 4 characters in a separate
column such as B1:B179 and in column C
=A1&B1
or
=B1&A1
Copy these down and then copy; edit, paste special, values to get rid of the
formulas.
Of course you can use the Edit, Paste Special, Values technique with either
Joel's or Gary's solutions to eliminate the formula and hense remove the
extra column.
|