View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Spliting digits up to fit paper form

Clif McIrvin wrote on 8/24/2011 :
dim strData as string
dim strDigit as string
dm ii as integer

strData=format([A1],"0.00")

for ii = len(strData) to 1 step -1
strDigit=mid(strData,ii,1)
if strDigit < "." then ' ignore decimal point ... remove if ... endif to
include "."
your code here

endif
next ii


Clif,
You could eliminate the check for the decimal by stripping it out
before you loop...

strData = Replace(Format([A1], "0.00"), ".", "")

--
I was thinking to 'pad' the string to always be Len=9. The wks can be
CF'd to hide leading zeros in the first 7 cols. This way, the digits
can be loaded into an array and 'dumped' into the wks.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc