ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding + 1 on each click. (https://www.excelbanter.com/excel-programming/282194-adding-1-each-click.html)

Nilrem

Adding + 1 on each click.
 

Ok, I'm new to excel and excel macros, however I am a programmer b
trade (C++) and I know enough VB to do the above in a standalone V
program, however in excel I'm lost.

I've created a macro to add +1 eachtime to a sell when I click
button, but all it does is change the actual cell to 1 instead o
adding 1 eachtime.

So basically, how can I achieve the +1 been added all the time i
Excel?

In C++ for example you could just have something like (off the top o
my head)

#include <stdio.h
#include <iostream.h

main()
{
int loop;
int total = 0;
int number = 0;

for (loop = 1; loop <= 5; loop++)
{
cout << "Please enter a number : ";
cin number;
total += number;
}
cout << endl << "The total is : " << total;
char.get();
return(0);


-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com


Ron de Bruin

Adding + 1 on each click.
 
Try this

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


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Nilrem" wrote in message ...

Ok, I'm new to excel and excel macros, however I am a programmer by
trade (C++) and I know enough VB to do the above in a standalone VB
program, however in excel I'm lost.

I've created a macro to add +1 eachtime to a sell when I click a
button, but all it does is change the actual cell to 1 instead of
adding 1 eachtime.

So basically, how can I achieve the +1 been added all the time in
Excel?

In C++ for example you could just have something like (off the top of
my head)

#include <stdio.h
#include <iostream.h

main()
{
int loop;
int total = 0;
int number = 0;

for (loop = 1; loop <= 5; loop++)
{
cout << "Please enter a number : ";
cin number;
total += number;
}
cout << endl << "The total is : " << total;
char.get();
return(0);
}


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/




Nilrem[_2_]

Adding + 1 on each click.
 

Thanks a lot I'll give it a whirl

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com



All times are GMT +1. The time now is 05:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com