Show Result in Userform TextBox as a percentage

Hutch1603

New Member
Joined
Apr 23, 2013
Messages
26
Hello,

I have a user form with 3 text boxes and 2 command buttons. My problem is getting text box 3 to perform a calculation based on cost price in text box 1 and the percentage I need to reduce it by to show the discounted buying price. So for example, if a product costs £100, take 20% off, then £80 should show in text box 3. Just cant figure out the code to get it to do this.

My user form loads, my command buttons to clear the text boxes 1&2 works, my command button to close the user form works. I have been trying to perform the calculation as follows:

Private Sub CalcDec()
TextBox3.value = ((TextBox1.value) - (1-(Textbox2.Value)))
End Sub

Additionally, I have the formula stared in Sheet1 of my workbook in cell B5. My formula is =B3-(1-(B4))

I have tried to use If and When Statements, all with no Luck. Can anyone point me in the right direction.
 
Hello All,

Thank you for your help with this. Your suggestions fixed the issue I was having. Your help was much appreciated :)
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

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