Prepending values in a column with "\"

  • Thread starter Thread starter Bill Fuller
  • Start date Start date
B

Bill Fuller

I would like to prepend all text values in a column with "\". What is the
easiest way to do this if there are thousands of rows?
 
Assuming column A has the text values.

In B1 enter ="\" & A1

Double-click on fill handle of B1 to copy down.

Copy then paste special(in place)>values>OK>Esc.

Delete original column A if desired.

Or you could use a macro to do in place with no formulas.

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


Gord Dibben MS Excel MVP
 
Back
Top