Consulting

Results 1 to 5 of 5

Thread: Solved: Userform Text Field Format

  1. #1
    VBAX Tutor
    Joined
    Oct 2012
    Posts
    298
    Location

    Solved: Userform Text Field Format

    Hi, I wonder whether someomne may be able to help me please.

    I'm using the code below to perform a calculation in a text field on a userform.

    [vba]Private Sub inputhours_Change()
    outputmandays.Value = CStr(Val(inputhours.Value) / 7.4)
    End Sub
    [/vba]
    The code works fine, but I'd like the format of my text field 'outputmandays' to be '0.00'.

    I've been trying to find a solution for this, this afternoon, but I've been unable to do so.

    I just wondered whether someone may be able to take a look at this please and offer some guidance on how I may go about achieving ths.

    Many thanks and kind regards

    Chris

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    [VBA]outputmandays.Value = Format(Val(inputhours.Value) / 7.4, "0.00") [/VBA]

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [VBA]outputmandays.Value = Format(Val(inputhours.Value) / 7.4, "0.00")[/VBA]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    VBAX Tutor
    Joined
    Oct 2012
    Posts
    298
    Location
    Hi @xld, thank you very much for taking the time to reply to my post. The solution works great.

    Kind regards

    Chris

  5. #5
    VBAX Tutor
    Joined
    Oct 2012
    Posts
    298
    Location
    Hi @Kenneth Hobs, thank you very much for taking the time to reply to my post. I really appreciate it. The solution works great.

    Kind regards

    Chris

Posting Permissions

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