ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Variant valiables problem (https://www.excelbanter.com/excel-discussion-misc-queries/205601-variant-valiables-problem.html)

[email protected]

Variant valiables problem
 
Problems with VBA variant type variables when I define DIM SUM_1 as
double after running the main program the end results have decimal
places that dont match. This is drive me nuts yet when I define it as
variant type the final results have all the decimal digits matching
up. IS there something particular about

"RESP = 5.55 * 0.3048 * 0.3048 * SUM_1 / (0.252 * 1.8)"

Because if I did say Sum_2 = SUM1 and then used SUM_2 above instead of
SUM_1 then I get right digits it seems that the SUM_1 in the above
expression is the only one that matters. The answer changes if SUM_2
is defines as variant or double.


Sub bootfile(I_1, OUTFIT_1, ISHI_1, ISPI_1, COVER_1, JCOOL2_1, CLO_1,
ISUBMP_1, AIRC_1, LIQC_1)
Dim SUM_1
....................... some code
SUM_1 = 0#
....................... some code
SUM_1 = SUM_1 + H(L_1, IPLUS) / XKI(IG)
....................... some code
RESP = 5.55 * 0.3048 * 0.3048 * SUM_1 / (0.252 * 1.8)
....................... some code
End sub


All times are GMT +1. The time now is 11:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com