+ Reply to Thread
Results 1 to 4 of 4

How to convert textbox to integer

  1. #1
    Forum Contributor
    Join Date
    09-20-2012
    Location
    Norge
    MS-Off Ver
    Excel 2007
    Posts
    114

    How to convert textbox to integer

    Hello,

    I find much information about converting a text box value to integer but I´m unable to get this to work in my code:

    Please Login or Register  to view this content.
    As you see my attempt on line 1 I keep getting the Compile error: Expected: identifier

    Just to clarify, I want to convert the tbAvtalenummer value from string to integer before it´s value is copied over to range("J2").


    Thanks in advance

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: How to convert textbox to integer

    Hi, tnuis,

    use a conversion like
    Please Login or Register  to view this content.
    Other which may work are CLng, CDbl or CSng as well as CCur depeneding on the range the variable stands for.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Contributor
    Join Date
    09-20-2012
    Location
    Norge
    MS-Off Ver
    Excel 2007
    Posts
    114

    Re: How to convert textbox to integer

    Hi HAHOBE,

    Thank you for your reply. I tried this and I now get the error Runtime error ´6´ Overflow ....

  4. #4
    Forum Contributor
    Join Date
    09-20-2012
    Location
    Norge
    MS-Off Ver
    Excel 2007
    Posts
    114

    Re: How to convert textbox to integer

    I solved it. Stupid me. My value was to big for integer. Had to use CDbl


    Thanks man!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 01-19-2014, 06:51 AM
  2. Check that input in textbox is an integer
    By marcusr in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-26-2007, 01:01 PM
  3. Convert to integer?
    By JohnLayne in forum Excel General
    Replies: 2
    Last Post: 10-31-2006, 10:18 AM
  4. [SOLVED] Integer only textbox?
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-02-2006, 11:05 AM
  5. How do i convert an integer to hh:mm
    By rjc_29 in forum Excel General
    Replies: 1
    Last Post: 02-07-2005, 09:17 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1