I thought I understood the VBA Format function codes, but apparantly
not.
I have several columns of numbers that I want to write to a file so
that they line up. Some of them are integers, some have a few decimal
places.
For the integers, I first tried "####0":
?format(123,"####0") & ""
123
I forgot that "#" does not insert spaces.
Next I tried "@@@@0":
?format(123,"@@@@0") & ""
1230
Now I get the spaces, but why am I getting the extra zero?
Next I tried "@@@@@":
?format(123,"@@@@@") & ""
123
This works, but it seems wrong. It works with zero, too:
?format(0,"@@@@@") & ""
0
This seems inconsistent with "#":
?format(0,"#####") & ""

Now for the nonintegers. Based on the above, I tried:
?format(4.56,"@@@.@@") & ""
4..56
What the heck? Why the extra "."?
Next I tried:
?format(4.56,"@@@.00") & ""
4.5.006
How do I format a number so I get 2 decimal places and 6 spaces
overall?
Is there any place where all of these codes are *clearly* explained?