saving long value in string varaibal ein vba code example

Example: excel vba data types

VBA Numeric Data Types                                                         Decimal
                                                                       Digits of
Largest CONSECUTIVE INTEGER Value              Type            Bytes   Precision  Description                           Minimum Negative Value         Maximum Negative Value          Default Value  Minimum Positive Value           Maximum Positive Value          Type              
---------------------------------------------- --------------- ------- ---------- ------------------------------------- ------------------------------ ------------------------------- -------------  -------------------------------  ------------------------------- ---------------
 2^8-1  = 		255							   Byte			  	 1                8-bit unsigned power-of-two integer    N/A                            N/A                             0             +1                               +255                            Byte			    
 2^15-1 = 		32767						   Integer   (%)  	 2                16-bit signed 2's complement integer  -32768						   -1                               0             +1                               +32767                          Integer   (%)            
 2^24   = 		16777216					   Single	 (!)  	 4       7        Floating Point IEEE 754 32-bit        -3.402823 x 10^38              -1.401298 x 10^-45               0             +1.401298 x 10^-45               +3.402823E38                    Single	 (!)   
 2^32-1 = 		2147483647					   Long	 	 (&)  	 4                32-bit signed 2's complement integer  -2147483648                    -1                               0             +1                               +2147483647                     Long	 	 (&)  
(2^63-1)/10k =	922337203685477    			   Currency  (@)  	 8       4        Scaled Integer/10k                    -922337203685477.5808          -0.0001                          0             +                                +922337203685477.5807           Currency  (@)   
 2^53   = 		9007199254740992			   Double	 (#)  	 8       15       Floating Point IEEE 754 64-bit        -1.79769313486231 x 10^308     -4.94065645841247 x 10^-324      0             +4.94065645841247 x 10^-324      +1.79769313486232 x 10^308      Double	 (#)  
 2^63-1 = 		9223372036854775807			   LongLong  (^)* 	 8                64-bit signed 2's complement integer  -9223372036854775808           -1                               0             +1                               +9223372036854775807            LongLong  (^)* 
 2^96-1 =       79228162514264337593543950335  Decimal           12      0 - 28   Scaled Integer                        -79228162514264337593543950335 -0.0000000000000000000000000001  0             +0.0000000000000000000000000001  +79228162514264337593543950335  Decimal        
                                               Variant                                                                                                                                                                                                                 Variant                      
                                               Subtype                                                                                                                                                                                                                 Subtype        

                                               
Note(*): The LongLong is only available in 64-bit VBA.
     
Note: The Variant data type can hold any of the above types as
      subtypes of the Variant, as well as Strings, pointers and
      error values.
                                               
Note: it is also possible
to store an integer as digits in the String data type: 
2^16 characters is the length limit for a fixed-length string.
2^31 characters is the length limit for a variable-length string.

Tags:

Html Example