vba - Split an integer into digits (Hundreds, tens, units) and store in ARRAYS -
I am working on some code which will calculate very big factual products which are very useful for long-integer I'm 2 to use 2 arrays, F () and C () F is for multi-fold products and to store units, C is for "carrier", which will be added later, so the units F (I) is deposited in, for example, C (I + 1) holds tens, C (I + 2) Hundreds Is. Later you will add C (I) + F (I). Single, Si (0 to 30) Single as C (0 to 30) Single in the form of Single, Split1 Single, Split 2 as single string in the form of string for the next, string as In the form of multi = What you need here either Try either: Or:
sub LargeFactCalc () F (1) = 1 N = InputBox ("The number that you want to make factual:") for J = 2 to N for I = 1 to 30 mult = J * F (I) Call split next I sum = C (I) + F (I) C (I + 1) = 0 C (I + 2) = 0 Next J. Print # 1, F (I) Close # 1 End Sub
< Pre> sub section (select case lane) Multi) Episode 1F (I) = Multi 'units 2C (I + 1) = Left (multi, 1)' tens F (I) = right (multi, 1 ) 'Unions Episode 3C (I + 2) = Left (multi, 1)' hundreds of C (I + 1) = 'tens should go here but I do not know the middle number F (I) = right (multi, 1 ) 'Unit and stitched end sub
Center function, which starts with special characters Many letters give ter, or a combination or
correct and
left function
Code> C (I + 1) = Left (right (multi, 2), 1) gives the most character on the left side 'most characters'
Comments
Post a Comment