Macro cannot read floating point numbers.

TracieD used Ask the Experts™
This Excel worksheet has a macro working well except those columns in DIVERSIFIED category (in 1st sheet), we use floating point numbers and they can't be read into the Matrix (Risk Matrix sheet). When you run the macro by clicking on Start Risk Maxtrix, every category table is filled out except Diversified table where only integer numbers are filled in. Is there a way to fix this problem? Thanks alot.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Try changing

                        If Cons = k Then


                        If Int(Cons) = k Then
I'm not sure, but I didn't see any type of dim statements.  It's quite possible that unless you dim the variable as double, you'll get Excel auto diming the statements as integer.

so add

dim k as double

 to the top of the code.

I assume based on the other comment that is the problem variable.


thanks. It works now. I didn't realize that little code of line in the 1st place.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial