+ Reply to Thread
Results 1 to 4 of 4

Rounding result in UserForm Textbox

Hybrid View

rahul_ferns76 Rounding result in UserForm... 01-19-2021, 08:56 PM
Trebor76 Re: Rounding result in... 01-20-2021, 12:12 AM
rahul_ferns76 Re: Rounding result in... 01-20-2021, 12:45 AM
Trebor76 Re: Rounding result in... 01-20-2021, 02:05 AM
  1. #1
    Forum Contributor
    Join Date
    02-23-2014
    Location
    Melbourne
    MS-Off Ver
    Microsoft 365
    Posts
    174

    Rounding result in UserForm Textbox

    Hi Experts
    I have the below VBA, which I need help with rounding the results

    What do I need to change to round the result to 2 decimal places?

    Private Sub cmdCalculate_Click()
    Dim noofLEDs, watts, amp As Double
    noofLEDs = txt_LEDS.Text
    watts = txt_Watts.Text
    amp = txtAmps.Text
    txtRAmps.Text = watts / (0.9 * 230)
    txtRkVA.Text = (noofLEDs * 3 * (amp / 1000)) / 0.9 / 1000
    End Sub
    The below is where I need the results rounded up to 2 decimal places
    txtRAmps.Text = watts / (0.9 * 230)

    Regards
    Rahul

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Rounding result in UserForm Textbox

    Hi Rahul,

    Try this:

    txtRAmps.Text = Round(watts / (0.9 * 230), 2)
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Forum Contributor
    Join Date
    02-23-2014
    Location
    Melbourne
    MS-Off Ver
    Microsoft 365
    Posts
    174

    Re: Rounding result in UserForm Textbox

    Thanks, Trebor
    Works like a charm

    Regards
    Rahul

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Rounding result in UserForm Textbox

    You're welcome. Thanks for rep

+ 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] Getting result nothing, when i am filtering numbers using textbox (userform)
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-17-2017, 06:09 AM
  2. [SOLVED] Vlookup through 3 sheets from one lookup value result in all textbox in userform vba
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-11-2014, 05:17 AM
  3. Userform textbox value with formula creates a result in excel
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-02-2013, 05:21 PM
  4. [SOLVED] Userform textbox value result formatted for date
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-29-2013, 03:28 PM
  5. [SOLVED] Using userform textbox value in code result
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-29-2013, 10:18 AM
  6. Display result in userform (vba) textbox
    By ilovelagar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-18-2009, 04:47 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