Consulting

Results 1 to 4 of 4

Thread: Solved: Changing String to Integer

  1. #1
    VBAX Regular
    Joined
    Nov 2008
    Posts
    41
    Location

    Solved: Changing String to Integer

    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?

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Use CInt.
    e.g.
    [VBA]Sub test()
    Dim s As String, i As Integer
    s = "12345"
    i = CInt(s) + 1
    MsgBox i
    End Sub[/VBA]

  3. #3
    VBAX Regular
    Joined
    Nov 2008
    Posts
    41
    Location
    Thank. Message can be changed to Solved now

  4. #4
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •