a string to an integer
Don't use String and Int as variable names.
String is a VBA function and data type.
Int is a VBA function.
Dim myString(1 To 3) As String
Dim myInt As Long
myString(3) = "543"
myInt = CInt(myString(3))
Personally, I wouldn't use "as integer" or cInt(). I'd use "As long" and
clng().
Philosophaie wrote:
I have a string:
string(3) = "543"
I try to change it to an integer:
int = cint(string(3))
It gives me a 'Type Mismatch' Error.
Maybe there may be spaces before of after the numbers but does that matter?
How do I change from a string to an integer?
--
Dave Peterson
|