excel vba convert string to a number if string is a number

C
MsgBox Val(str)

'If string does not start with a numeric text value, Val() returns a zero.
Source

Also in C: