Formatting Cells?

B

Ben

Hello,
I need to know how to put an * before and after each value I have in a
column. For example, if Column A is 1 to 5, I will paste them in B, and then
change them to barcode font. My scanner only reads barcodes that start and
end in an * . It is easy to do it for a few by hand, but when there are
thousands, there has to be an easy way to do it. Thanks in advance.
 
G

Gord Dibben

Ben

With "thousands" a macro may serve you well to change them in place.

Sub Add_Text()
Dim cell As Range
Dim thisrng As Range
On Error GoTo endit
Set thisrng = Range(ActiveCell.Address & "," & Selection.Address) _
.SpecialCells(xlCellTypeConstants, xlTextValues)
For Each cell In thisrng
cell.Value = "*" & cell.Value & "*"
Next
Exit Sub
endit:
MsgBox "only formulas in range"
End Sub


Gord Dibben MS Excel MVP
 
Top