PDA

View Full Version : Solved: Changing String to Integer



Marcke
11-18-2008, 09:37 AM
I'm puzzled about a very simple thing: Changing a Value that's a String to an Integer.

In Delphi it's StrtoInt, but what is it in VBA?

Kenneth Hobs
11-18-2008, 09:46 AM
Use CInt.
e.g.
Sub test()
Dim s As String, i As Integer
s = "12345"
i = CInt(s) + 1
MsgBox i
End Sub

Marcke
11-18-2008, 09:48 AM
Thank. Message can be changed to Solved now :)

GTO
11-18-2008, 11:38 AM
Hi Marcke,

It's up to you to mark it "Solved". When you open the thread, look right above your first post for the drop-down named Thread Tools; there's a Mark Solved option under it.

Have a great evening,

Mark