ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Value Issue (https://www.excelbanter.com/excel-programming/379164-value-issue.html)

ankur

Value Issue
 

Hi All,

I have a value in cell A1. The format of cell is General.
Now using a function I am checking if the value is = 0.35 like
below...

sub test()

Dim TestValue as double

TestValue=Range("A2").VALUE

If TestValue = 0.35 then
msgbox "Yes"
End if
end sub

The strange thing is when the value in the Cell A1 is 0.35 still the
condition is not satsified. I checked the Value of the TestValue by
putting the cusrson on it and 0.35. So when TestValue is 0.35 and
condition is 0.35 then why don't the if does't work.

I understand this is a little strange. Any help would be greatly
appreciated.

Thanks
Ankur
www.xlmacros.com


Kweenie

Value Issue
 
Hi Ankur

I just found out that is has to do with the settings in
Tools - Options - International
I don't know the exact translation (I.m using the Dutch version)
But changing the separationmark gave the desired result
Anyway in my case

Hope it helps

Regards

Piet



ankur schreef:

Hi All,

I have a value in cell A1. The format of cell is General.
Now using a function I am checking if the value is = 0.35 like
below...

sub test()

Dim TestValue as double

TestValue=Range("A2").VALUE

If TestValue = 0.35 then
msgbox "Yes"
End if
end sub

The strange thing is when the value in the Cell A1 is 0.35 still the
condition is not satsified. I checked the Value of the TestValue by
putting the cusrson on it and 0.35. So when TestValue is 0.35 and
condition is 0.35 then why don't the if does't work.

I understand this is a little strange. Any help would be greatly
appreciated.

Thanks
Ankur
www.xlmacros.com




All times are GMT +1. The time now is 03:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com