View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Gatrie Gatrie is offline
external usenet poster
 
Posts: 1
Default How to add a "0" (zero) to the front of existing data in cells

I need to add zeros to the front of existing data. When I use "custom" the
presentation of the data on the changes but the format of the data has not
actually changed. How do I get the "0s" to precede the data even when copied?

"Gord Dibben" wrote:

A million cells.............?

Sub Add_Text_Left()
Dim cell As Range
Dim moretext As String
Dim thisrng As Range
On Error GoTo endit
Set thisrng = ActiveSheet.UsedRange _
.SpecialCells(xlCellTypeConstants, xlTextValues)
moretext = "0"
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

On Tue, 15 May 2007 10:48:01 -0700, Primbarbi
wrote:

If anyone can help, I'd appreciate it..........so I don't have to add a "0"
to the front of a million cells......