VBA Maths

tr03bor

Board Regular
Joined
Mar 12, 2008
Messages
64
Hello!

I have three combo boxes, 1 2 and 3.

Trying to work out 22% of combo box 1 and put the value in combo two and the total in combo three, its works, but I only want it to return to decimal places!

Help!!! :biggrin:

Private Sub CommandButton1_Click()
TextBox2.Value = TextBox1.Value * 0.22
TextBox3.Value = TextBox1.Value * 1.22
End Sub
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Ah thanks!!!

Say I then put a combo box in, with two options, high and low.

If the user selects high, then the rate is 22%, if the user selects low, then the rate is 10%.

how would I do that?
 
Upvote 0
Example:

Code:
Private Sub CommandButton1_Click()
    Select Case ComboBox1.Value
        Case "High"
            TextBox2.Value = WorksheetFunction.Round(TextBox1.Value * 0.22, 2)
        Case "Low"
            TextBox2.Value = WorksheetFunction.Round(TextBox1.Value * 0.1, 2)
    End Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,206,970
Messages
6,075,921
Members
446,170
Latest member
zzzz02

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