Range Problem
1.3000687785 is a double. You should try being more specific with the
way you declare your variables. If you use:
Dim rng1, rng2, rngt,lv,hv,yr1,yr2 As Double
Then yr2 will be a double while rng1, rng2, rngt etc will all be
Variants. You should use:
Dim rng1 as range
dim rng2 as range
dim lv as double
etc
or
dim rng1 as range, rng2 as range, lv as double etc
Hope this helps
Rowan
jesmin wrote:
Hi Rown:
I found the problem. Its the data type. I declared the variable lv, hv
as variant. In 2nd case, hv=1.60026386 and it failed. I put a smaller
number 1.3098 and it ran fine in 2nd call. So I changed them to double.
Now I get another value for hv as 1.3000687785 and this time it failed
again. I will better format the data to 4 decimal first and then will
calculate. Is not 1.3000687785 is a double? What is the safe data type
that I can declare in case of decimals.
Thanks
|