View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
a.riva@UCL a.riva@UCL is offline
external usenet poster
 
Posts: 20
Default split a number into its digits

Have you tried with string formulas such as MID?
Using a For ... Next loop you could write a procedure that extracts at
each recursion one of the digits, and you could store them in an
array.

For example:

For i=1 to Len(number)
digit(i) = MID(number, i, 1)
Next i

Antonio.


On 15 Oct, 17:08, Paco wrote:
Hi Guys! I need to split numbers into its digits which i will latter assign
to variables. For instance:
originalNumber = 12345

then
a = 1
b = 2
c = 3
d = 4
e = 5
I am building a macro, so I cannot use the "text to columns trick" with
fixed delimiters
Thanks a lot guys!!