PDA

View Full Version : ReTry



kme.amoah
03-08-2021, 02:33 PM
Hello,


I have been working on this for awhile and still not coming up with what i need.
Every leads will be appreciated.


***
Write a macro that does the following actions:
The macro asks the user to make the sum of two numbers while the answer is not correct.
When the user finds the right answer, the macro will write in cell A1 the number of tries necessary to find the right answer.
You can write these two numbers directly in the code of the macro.
****


Thank You.

Kenneth Hobs
03-08-2021, 04:12 PM
Your first post is about a homework problem?

See the faq: http://www.vbaexpress.com/forum/faq.php?faq=psting_faq_item#faq_hom_faq_item

SamT
03-08-2021, 04:20 PM
A homework assignment.

You will need at least one Variable to hold the number of attempts.
You can use two more variables to hold the numbers.
Then you can use an InputBox to ask the User the question.

It will probably be easier to understand the code if you use a fourth variable to hold the answer

You will need to use a loop such as
Do While Not Answer = Sum(Var2, Var3)
Answer = CLng(InputBox blah blah blah)
Var1 = Var1 + 1
Loop
Range("A1") = Var1

Paul_Hossler
03-11-2021, 07:03 AM
Hello,


I have been working on this for awhile and still not coming up with what i need.
Every leads will be appreciated.


Show us what you have so far