View Full Version : Solved: New calculator Basic Formulas
Darren
08-18-2007, 11:47 AM
Hi Masters
I have created a new userform which will be one of the calculator in a series and i need some help. Thank you XLD and malcom for you help with this little project.
the heading above each text box is an explanation of what needs to happen. I have labelled the controlls as well as mentioned previous by XLD and Malcolm
Thanks guys
Darren
South Africa
ps. By the end of this little project i should have some understanding of the code
mdmackillop
08-19-2007, 03:57 AM
Hi Darren
Can you replicate your userform on a spreadsheet and insert the basic formulas you wish used and highlight the data entry cells. Remember that in a coded userform, a textbox can be used both to enter data and show results of data entered elsewhere
eg
Private Sub TextBox1_AfterUpdate()
TextBox2 = 2 * TextBox1
End Sub
Private Sub TextBox2_AfterUpdate()
TextBox1 = 0.5 * TextBox2
End Sub
Darren
08-19-2007, 05:56 AM
Hi Darren
Can you replicate your userform on a spreadsheet and insert the basic formulas you wish used and highlight the data entry cells. Remember that in a coded userform, a textbox can be used both to enter data and show results of data entered elsewhere
eg
Private Sub TextBox1_AfterUpdate()
TextBox2 = 2 * TextBox1
End Sub
Private Sub TextBox2_AfterUpdate()
TextBox1 = 0.5 * TextBox2
End Sub
Hi Malcolm
Thanks for the reply i will test with the above example
attached nuts and bolts spreadsheet
mdmackillop
08-19-2007, 07:04 AM
I'm not totally clear on the functionality, but here's some basic code to fill in the blanks. I've picked up some data from range G7; adjust to suit
Option Explicit
Private Sub UserForm_Initialize()
Dim Gross
Gross = Range("G7")
lblBasicInFormulas = Format(Gross, "#,##0.00")
BTurnover = Format(Gross, "#,##0.00")
ITurnover = Format(Gross, "#,##0.00")
End Sub
Private Sub CFoodcost_AfterUpdate()
CFoodcost = Format(CFoodcost, "#,##0.00")
FTotalCost.SetFocus
End Sub
Private Sub CFoodcost_Change()
AGross = Format(BTurnover - CFoodcost, "#,##0.00")
EGrossProfit = AGross
End Sub
Private Sub FTotalCost_AfterUpdate()
FTotalCost = Format(FTotalCost, "#,##0.00")
End Sub
Private Sub FTotalCost_Change()
DNettProfit = Format(EGrossProfit - FTotalCost, "#,##0.00")
HNettProfit = DNettProfit
GPercentNett = Format(HNettProfit / ITurnover, "0.00%")
JBreakEvenpoint = Format(FTotalCost * BTurnover / AGross, "#,##0.00")
End Sub
Darren
08-19-2007, 11:07 AM
Hi Malcolm
Just got in and thank you for your help. I will advise
Darren
SouthAfrica
Darren
08-19-2007, 02:26 PM
Hi Malcolm
Thank you it works well and as it should, one small problem is backspace to enter different food cost i get type mis match hmmm tried applying If textbox.value "" statement but not working, any text box should accept backspace.
Thanks
Darren
South Africa
Local time 11h26 pm Sunday
than
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.