I think you may have misunderstood the code: the rounding tolerance is the multiple to which the numerical values should be rounded - in your case, to round to the nearest integer, you would specify a rounding tolerance of 1.
[/quote]
Hi Mr Lee, your guess is right. I define a value 5 at first instead of .5 during testing. But yeah setting 1 to round off to nearest integer is working fine too. Thanks for your help and bright code.