add a word to text in a cell
Alan
VBA macro........
Sub Add_Text_Left()
Dim Cell As Range
Dim moretext As String
Dim thisrng As Range
On Error GoTo endit
Set thisrng = Range(ActiveCell.Address & "," & Selection.Address) _
.SpecialCells(xlCellTypeConstants, xlTextValues)
moretext = InputBox("Enter your Text")
For Each Cell In thisrng
Cell.Value = moretext & Cell.Value
Next
Exit Sub
endit:
MsgBox "only formulas in range"
End Sub
In the "Enter your Text" inputbox enter "this "(no quotes and note the
<space)
Gord Dibben Excel MVP
On Fri, 18 Feb 2005 15:29:07 -0800, "AlanG"
wrote:
I have a text string in a cell and I want to add a new text string in front
of the existing text string in the same cell. For example, the word "place"
is already in the cell and I want to add the word "this" in front of the word
"place" to form a new string in the cell that is "this place". How would I do
this in visual basic?
|