+ Reply to Thread
Results 1 to 4 of 4

is userform textbox input by user default TEXT?

  1. #1
    Registered User
    Join Date
    11-19-2007
    Posts
    85

    is userform textbox input by user default TEXT?

    If it is how do I convert the user input for the text box field as number. thx
    Last edited by JohnSeito; 04-01-2009 at 07:46 AM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: is userform textbox input by user default TEXT?

    Hi John,

    It depends on where your textbox is. If it's a textbox on a sheet, and it is linked to a cell (let's say A1), then you could use the VALUE() function to convert it to a number, e.g.

    =VALUE(A1)*60

    If it is on a UserForm, and you're referencing it via VBA, use the Val() function to convert it, e.g.
    Please Login or Register  to view this content.
    Although myVal = Textbox1.Value * 60 should also work.

    Hope that helps!
    Last edited by Paul; 03-31-2009 at 10:12 PM.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: is userform textbox input by user default TEXT?

    The default is a string. There are are several options depending on the numeric type required, Use the Type Conversion Functions

    CCur(TextBox1.Value) - Currency
    CDbl(Me.TextBox1).Value - Double
    CInt(Me.TextBox1.Value) - Integer
    CDate(Me.TextBox1).Value-Date

    See the VBA Help files
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    11-19-2007
    Posts
    85

    Re: is userform textbox input by user default TEXT?

    pjoaquin and royUK


    thanks for the help. So far I don't have that string problem any more. I am still working on the program and well see it any other issues arise. As of now the string problem is resolved. thanks.

+ 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