Formatting Cells?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top