i had some time so i went ahead & did this. it works for me, making
all the #s 5 digits by adding leading zeros. it's a worksheet
button. you could easily change it to run on whatever range you have
selected, instead of specifying a specific range.
susan
=================
Option Explicit
Private Sub CommandButton1_Click()
Dim ws As Worksheet
Dim rRange As Range
Dim c As Range
Dim sZeros As String
Dim sNumber As String
Dim myCell As String
'the objective is to make them all 5 digits
'with the proper amount of leading zeros
Set ws = ActiveSheet
Set rRange = ws.Range("b2:b12")
On Error Resume Next
For Each c In rRange
myCell = c
sNumber = c.Value
If Len(myCell) = 1 Then
sNumber = "'0000"
ElseIf Len(myCell) = 2 Then
sNumber = "'000"
ElseIf Len(myCell) = 3 Then
sNumber = "'00"
ElseIf Len(myCell) = 4 Then
sNumber = "'0"
ElseIf Len(myCell) = 5 Then
'do nothing
End If
If Len(myCell) <> 5 Then
c = sNumber + myCell
myCell = ActiveCell.Offset(1, 0)
Else
sNumber = "'"
c = sNumber + myCell
myCell = ActiveCell.Offset(1, 0)
End If
Next c
End Sub
=========================