View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default 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/