Simple VBA devision problem

  • Thread starter Thread starter phillip harrison
  • Start date Start date
P

phillip harrison

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
 
Use Double instead of Long

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

VBA help 5
using vlookup in vba 10
make selection in listbox html with vba 0
Trig Problems 3
Rounding problem 9
Rounding in VBA 4
VBA not producing decimals 3
Problem using & 3

Back
Top