ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple VBA devision problem (https://www.excelbanter.com/excel-programming/274618-simple-vba-devision-problem.html)

phillip harrison

Simple VBA devision problem
 
Hi there

I've got a problem which envolves simple devision with decimals but VBA
is rounding it to an integer.

My code is this:

NumBound = MaxValue / SharedValues

All 3 values are defined as Long

The problem comes when MaxValue is, say 8113.567235, SharedValues is,
say 18236 and thus NumBound should equal 0.4449203 but comes up as 0.

This then results in my further calcuations producing an error as I have
to devide by NumBound, i.e. 0 which is not possible.

Any help would be greatly appreciated

Thanks

Phillip

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Wild Bill[_2_]

Simple VBA devision problem
 
Use Double instead of Long

Look at Data Type Summary if your version has this in Help

phillip harrison

Simple VBA devision problem
 


ahhhhh .. grand.. thanks

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 08:55 PM.

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