?val("0,5")
0
?val("0.5")
0,5
val(replace("0,5",",","."))
Select Case KeyAscii
Case vbKey0 To vbKey9, vbKeyBack, vbKeyClear, vbKeyDelete, vbKeyLeft, _
vbKeyRight, vbKeyUp, vbKeyDown, vbKeyTab, vbDecimal
Case Else
KeyAscii = 0
Beep
End Select
'Locale support
Private Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long
Const LOCALE_ICOUNTRY = &H5 ' country code
Const LOCALE_SENGCOUNTRY = &H1002 ' English name of country
Const LOCALE_USER_DEFAULT = &H400
If getLocale <= 1 Then 'US
'use commas
else 'UK
'use period
End If
? val("2.500,50")
2,5
? cdbl("2.500,50")
2500,5
? val("2,500.50")
2
? cdbl("2,500.50")
2,5005