Calculator using Excel VBA UserForm:Project Objective. Calculator using Excel VBA UserForm. Following is the step by step detailed explanation to automate this project using VBA. How we are doing calculations, clear the text, etc. PREMIUM TEMPLATES LIMITED TIME OFFER. ON SALE 80% OFF.
Hello everybody
I need help to complete my project.
It's a calculator program. Most of the code is complete
IT SHOULD FUNCTION JUST AS THE PROGRAM CALCULATOR FOUND ON WINDOWS VISTA
I just have two problems
1)It should perform a continuous operation between numbers, without pressing the equal button. In other words my program just performs a mathematical operation between two numbers
For instance : If i click 4 * 2 + 3 and if i click equal it gives me 5, but it should give 11
2) other problem i have is that if i click a number and add/substract/multiply/or divide with another number it dissapears
For instance: if i click 4 and if i clcik + the 4 dissapears from the textbox
PLEASE HELP ME AS SOON AS POSSIBLE
THANK YOU!!!!!!!
Since it does not let me attach my file I will post my code
PS: If someone does not understand my problems. PLEASE OPEN A CALCULATOR PROGRAM that you have in your computer, and compare it to my program and you will see the 2 differences/ problems i have
- 3 Contributors
- forum3 Replies
- 1,688 Views
- 4 Weeks Discussion Span
- commentLatest Postby kleva
Solving your first issue with mishandling of the calculation.
This is because of how the add subtract multiply divide buttons are coded.
Your program will currently take the 4 when you press and store to mfirst, then overwrite mfirst with the 3 because you only have one primary storage variable. Hence the 5 as result as the program is storing 3 + 2.
To solve this you could use an array to store the added numbers in as this would allow you to have unlimited numbers in a calculation. A third variable would also be another method and the one i shall use for this solution as I had to make a calculator for college last year :)
I have not written any of the following code in VB as i'm on my Mac and got no IDE on here so it may have the odd error. Hopefully not though.
Insert the IF function into all four of your button's code
Answer changes:
I cannot work out your second issue from the code and I obviously can't look at in an IDE like i stated above :)
Try the suggestions i have made and get back to me on whether they work or not :)
Mike.