Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003

    Unanswered: VBA in EXCEL - Formating text box


    I'm having a problem in my vba code.
    I have a userform with some text boxes and the values that I enter when i run the code are not what i want.

    I put a value like " 0.23" in the text box and if i insert a msgbox to return me the value inserted it shows 23, but the value is inserted in the worksheets of excel has 0.23 !?!

    The text box is defined as "preco" and then i have something like this:

    prc = preco.Value
    MsgBox prc ' shows me 23!!!
    When i select a cell in excel to input the value it appears 0.23 but then i have : prc * quantidade.Value
    and i get the "quantidade.value" * 23 and not the 0.23

    Can anybody help me?
    Sorry about the english

  2. #2
    Join Date
    Aug 2003
    It sounds like a formatting issue. Go into Format Cells on the cell with the value in on the worksheet. Click on the format tab and check the format of the cell.

    If this is ok, you might have to use a format function in the MSgBox:

    MsgBox Format(myValue, "0.00")

Posting Permissions

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