how to roundup and round down textbox value

manissinha

New Member
Joined
Jul 7, 2017
Messages
9
Hi All,

I have created userform and want to roundup and round down the entered values

If i enter positive value with decimal value it should round down
example if i enter 5.01 it should give 5.00 , or for 5.99 should give 5.00

If i enter negative value with decimal value it should round up
example if i enter 5.01 it should give 6.00 , or for 5.99 should give 6.00

regards
manish
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Code:
Private Sub TextBox1_AfterUpdate()
  With TextBox1
    If Not IsNumeric(.Value) Then Exit Sub
   .Value = Format(Evaluate("int(" & .Value & ")"), "0.00")
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,032
Messages
6,122,772
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top