+ Reply to Thread
Results 1 to 5 of 5

Userform TextBox Problem... formatting code clears data instead of formatting

  1. #1
    Registered User
    Join Date
    06-12-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    54

    Userform TextBox Problem... formatting code clears data instead of formatting

    Friends,

    Please Login or Register  to view this content.
    I don't understand what the problem is... Without the second line, my text box has a value but with a million decimal places. Butwith the second line, the textbox is just blank...

    Any suggestions?

    Many Thanks,

    -Mike

  2. #2
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: Userform TextBox Problem... formatting code clears data instead of formatting

    You need to include the Range("N41"):

    Please Login or Register  to view this content.
    Otherwise it interprets Value as a variable with nothing assigned to it.

  3. #3
    Registered User
    Join Date
    06-12-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Userform TextBox Problem... formatting code clears data instead of formatting

    Wallyeye,

    Thanks so much that worked great!

    One other question... I have a userform that accepts the lengths of three sides of an oblique triangle and calculates the area using Heron's formula. So if I have the user entering values in, say, TextBox1, TextBox2, and TextBox3 then AreaBox has the calculated area. What is the syntax to have AreaBox formatted to three decimal places?

    Thanks!

  4. #4
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: Userform TextBox Problem... formatting code clears data instead of formatting

    You would just use:

    Please Login or Register  to view this content.
    Where dblResult is the result of your calculation.

  5. #5
    Registered User
    Join Date
    06-12-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Userform TextBox Problem... formatting code clears data instead of formatting

    Awesome! Thanks!

    My problem was that i was not storing the result as a variable... So AreaBox.Value = TextBox.Value * TextBox2.Value

    But now Area = TextBox.Value * TextBox2.Value and then formatting.

    Thanks Again!

+ 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