View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
[email protected] fixer33@hotmail.com is offline
external usenet poster
 
Posts: 2
Default Macro Help replacing dropped zeros

Woohoo, thanks for all the help, had to sleep for a while, Toppers
macro works fine, I cant express my appreciation, this really saved me.
Darrell

Ken Johnson wrote:
Hi,
If it has to be a macro this works if you run it after selecting the
range of cells...

Public Sub add_zeros()
Dim vaData As Variant
vaData = Selection
Dim I As Long
Dim J As Long
For I = 1 To UBound(vaData, 1)
For J = 1 To UBound(vaData, 2)
vaData(I, J) = "'" & _
WorksheetFunction.Rept("0", 9 - Len(vaData(I, J))) _
& vaData(I, J)
Next J
Next I
Selection = vaData
End Sub

Ken Johnson