The bad news is that numberformat works with numbers. If you keep your data as
numbers, you lose the 16th character. If you change the value to text (either
preformatting or using the leading apostrophe), then numberformat won't work.
On way around it is to use a worksheet event that does the "formatting" for
you. It actually changes the value by inserting spaces.
If you want to try this idea, rightclick on the worksheet tab that should have
this behavior. Select view code. Paste this into the code window:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myTempVal As Variant
On Error GoTo errhandler:
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("a:a")) Is Nothing Then Exit Sub
If IsNumeric(Target.Value) = False Then Exit Sub
myTempVal = CDec(Target.Value)
Application.EnableEvents = False
Target.Value = Format(myTempVal, "0000 0000 0000 0000")
errhandler:
Application.EnableEvents = True
End Sub
I used all of column A in this line:
If Intersect(Target, Me.Range("a:a")) Is Nothing Then Exit Sub
but you could use:
If Intersect(Target, Me.Range("c7:g99")) Is Nothing Then Exit Sub
But make sure whatever range you use is preformatted to text. If you leave it
general, then that 16th digit is already a 0 when the code starts.
If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm