Home vba number type error
Reply: 0

vba number type error

user687
1#
user687 Published in July 22, 2018, 8:37 am

I have a simple problem with the following sub:

For A1 = 0.01 & A2=0.34 values on the "Sheet1" sheet run the following:

         Sub test()
            tmp = Sheets("sheet1").Range("A1")
         If tmp < 10 Then
            MsgBox ("O")
         End If

         tmp1 = Sheets("sheet1").Range("A2")
         If tmp1 < 10 Then
           MsgBox ("P")
         End If

         End Sub

The problem is that when the value=0.01 (please not the dot instead of comma) the condition is true BUT when the value =0.34 then is false which is not the eexpected result.

Is the format wrong?

Thank You In Advance.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.328423 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO