+ Reply to Thread
Results 1 to 5 of 5

Format number in message box that contains other text

  1. #1
    Registered User
    Join Date
    06-06-2013
    Location
    Cape Town, South Africa
    MS-Off Ver
    Excel 2010
    Posts
    5

    Format number in message box that contains other text

    Hello

    I am stuck with this problem. I have a command button in a userform. This button calls up a message box and in this message box it displays some text followed a number, which is linked to a cell in the spreadsheet that contains a mathematical formula. The number is displayed with 11 decimal places but I want the number to only show 2. How do I go about doing this?

    Here is my code:

    Please Login or Register  to view this content.
    CalculationsSheet is the name of the sheet,
    Calculation1 is the name of the cell, this cell contains a formula

    The above code is displaying the message box as follows:

    Results 1 = 11546.85623145612
    Results 2 = 556.87452114585

    But I want the numbers to only have 2 numbers after the decimal place, i.e. Results 1 = 11546.86

    Thanks

  2. #2
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Format number in message box that contains other text

    Try

    Please Login or Register  to view this content.
    If you like my contribution click the star icon!

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    If the numbers on the sheet have the format you want try this.

    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    06-06-2013
    Location
    Cape Town, South Africa
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Format number in message box that contains other text

    Thanks! Both options work!

    Much appreciated!

  5. #5
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Format number in message box that contains other text

    As that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED,as per Forum Rule #9. Thank you.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

+ 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. Convert date and time in serial number format to text format
    By nda13112 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-11-2013, 02:45 PM
  2. Changing numbers from text format to number format
    By garden_gnome in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-09-2012, 12:48 PM
  3. How do I format the text in a message box?
    By etindell in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-26-2010, 04:15 PM
  4. Format Message Box Text
    By DCSwearingen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2007, 01:01 PM
  5. Change number (in text format) to numeric format
    By Pam in forum Excel General
    Replies: 5
    Last Post: 10-24-2005, 03:05 PM

Tags for this Thread

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