Im from Brazil, and my regional seeting are "," to separete decimal places

But when i use VBA to read a cell value, if it is 0,93 he only reads 0, but if it is 0.93, he reads correctly

this is a sample of the code that i'm using
Code Snippet

Dim Proj(500, 500) As Double

Proj(3, L) = Val(Cells(21 + L, "N").Value)

My regional settings are ok

Re: Problen reading Cell


I believe the problem is the use of the Val function which takes a string argument. VAL reads the argument from left to right and stops at the first non-numeric character. Apparently this function does not consider your regional settings and kicks out at the comma. If you remove the VAL function so you have Proj(3,L) = Cells(21+L,"N"), I think you'll have better results.

Re: Problen reading Cell


thank you.. i solved the problem changing val to cdbl

it worked fine for me