+ Reply to Thread
Results 1 to 5 of 5

CInt() conversion & inputbox

  1. #1
    Registered User
    Join Date
    06-26-2009
    Location
    O.o
    MS-Off Ver
    Excel 2003
    Posts
    64

    CInt() conversion & inputbox

    Hi everybody, as i understand CInt() converts STRING variables to INTEGER variables.

    I am trying to create an inputbox, with input validation. So, if the user types in an integer, it will continue to a msgbox; if they type a number in string format, as in 'two', it will convert this into an integer and again display it in a msgbox; if they press nothing a msgbox will appear telling them there is no input; and if they press cancel the programme closes. Any help would be appreciated.



    Please Login or Register  to view this content.
    Last edited by dems; 07-06-2009 at 01:44 PM.

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: CInt() conversion & inputbox

    Hi dems,

    No, the CInt (VBA) function converts a value to an integer (see here for more details).

    Not sure what you're trying to achieve, but I've together the following example with some notes to hopefully help you along the way:

    Please Login or Register  to view this content.
    HTH

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: CInt() conversion & inputbox

    dems,

    Please take a few minutes to read the forum rules, and then change your QUOTE tags to CODE tags.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    06-26-2009
    Location
    O.o
    MS-Off Ver
    Excel 2003
    Posts
    64

    Re: CInt() conversion & inputbox

    Thank you Trebor, that was very helpful! I was wondering if it was also possible to convert numbers written in letters into the equivalent positive integers and display it in the last msgbox?

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: CInt() conversion & inputbox

    Not with any standard functions, but code has no doubt been written to do so.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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