+ Reply to Thread
Results 1 to 7 of 7

Format TextBox Numeric value only

  1. #1
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Format TextBox Numeric value only

    Hi guys,

    How can I format the value of a TextBox to only except numeric values?

    i want a user to be warned if the value is not according to the correct format.

    Please Login or Register  to view this content.
    Thank you all!

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Format TextBox Numeric value only

    Hi,

    One way
    Please Login or Register  to view this content.
    If the 2001 HAL spoken words get on your nerves just comment out the s.Speak line
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Re: Format TextBox Numeric value only

    NICE!

    Thank you for the help! i think the voice might be over the top, but you taught me something new today. Great.

  4. #4
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Re: Format TextBox Numeric value only

    There is something else I wanted to know: how can I further format the numeric value as follows:

    limit the numbers to maximum 4 digits
    add a thousand space (X XXX)
    automatically add "," and 2 decimals (X XXX,XX)

    Cheers!

  5. #5
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Re: Format TextBox Numeric value only

    Quote Originally Posted by onmyway View Post
    There is something else I wanted to know: how can I further format the numeric value as follows:

    limit the numbers to maximum 4 digits
    add a thousand space (X XXX)
    automatically add "," and 2 decimals (X XXX,XX)

    Cheers!
    Hi guys,

    Any idea how I can format my numeric field as per above?

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Format TextBox Numeric value only

    Like so:
    Please Login or Register  to view this content.
    assuming the settings you mentioned are your regional settings.
    Remember what the dormouse said
    Feed your head

  7. #7
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Re: Format TextBox Numeric value only

    Thank you, Rory!

    My code has changed a bit, and I am using a Function now.

    Where and how can I add this line:

    Please Login or Register  to view this content.
    to my new code? I have tried various ways, but am not sure whether to use Else or If or Next ....

    Please Login or Register  to view this content.
    Last edited by onmyway; 01-27-2015 at 04:00 AM.

+ 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. [SOLVED] Set Format of TextBox linked cell to number/numeric Value.
    By pipoliveira in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-23-2014, 07:22 AM
  2. Multiplying a numeric value textbox by a duration value textbox
    By chrisjames25 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-01-2013, 05:05 AM
  3. Numeric Textbox Properties
    By puuts in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-09-2013, 08:31 AM
  4. Numeric Values in a textbox
    By GogsJames in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-20-2006, 01:18 AM
  5. Format Numeric data in Textbox
    By stickandrock in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-24-2005, 09:05 PM

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