Can a macro add a number?

Solved/Closed
Giorgio.usa - May 12, 2010 at 08:54 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - May 13, 2010 at 10:14 AM
I am working on a excel project where I will be able to click a button and the result would be a number added on another cell. For example, counting a products sale, if I have sold 5 I click that button 5 times and the result cell would have a +5 number. Is that possible? Anybody can help me with this? Another way could be to digit the number 5 on a cell and this will be added on the result cell, this can be an option too.
Thank you very much in advance :)

Related:

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
May 12, 2010 at 09:13 AM
both are possible via macro
1
Funny answer :) Can you also tell me how?
Thanks.
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
May 12, 2010 at 10:05 AM
Ah glad you found it amusing :p~~. It was not intended.

Best would be have the clicks. To do that

1. Press ALT + F11 to start VBE
2. Click on Insert and add a new module
3. Paste the code below


Sub myButton()

Range("A1") = Range("A1") + 1

End Sub

4. Now on you sheet add the button and assign it the macro
0
It worked! Yayy, thanks rizvisa1. I also found the way to add another macro, since they will be many buttons. I add the same code with different cell #s after the End Sub, is this the right way? Now I only have to find the way how to create a button :)
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
May 13, 2010 at 08:17 AM
What version of excel you are going to use for this ? Why not use help to find out how to add button. Basically its on toolbox
0
Thanks again, I found out how to make a button with text inside. Now I have to repeat the macro command to different cells and same with buttons, and it should work out good. Thanks for your help :)
0