View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default adding numbers macro

no need for a macro.

If the checkboxes are from the Forms toolbar, select each checkbox and
choose Format/Control. In the Control pane, enter an out of the way cell
in the Cell Link box, say, Z1 for thefirst row, Z2 for the second, and
Z3 for the third.

Then in A5:

=A1*($Z1=TRUE) + A2*($Z2=TRUE) + A3*($Z3=TRUE)

or, a bit more efficiently:

=SUMPRODUCT(B1:B3,--$Z1:$Z3)

You can then copy the formulae in A5 to B5 and C5.

You can download a sample workbook he

ftp://ftp.mcgimpsey.com/excel/arciduca79.xls


In article ,
arciduca79 wrote:

Hi all,
I am very unexperienced so this may sound too easy for someone, but it'
actually getting on my nerves... Here's the deal:
I'm working on an excel spreadsheet and I want to add a check box with
a "double" macro that does (when selected) and "un-does" (when blank)
an operation on a series of numbers.

Say I have these random numbers:

2 5 5
3 4 5
1 9 7

x y z

..where "x, y, z" are the blank cells where I'd like the result of the
operation to appear.

I want to add a checkbox on each line that, when clicked on, takes
every number in the line and re-writes it in the "x" cell, making it
possible to sum it to the others. Say, writing something like "+A1" in
the "x" cell, "+B1" in the "y" cell and "+C1" in the "z" cell (where
"A1" is the name of the cell where number 2 is, and so on).

So if I click on two checkboxes, I will have "+A1+A2" in the "x" cell,
"+B1+B2" in the "y" cell and "+C1+C2" in the "z" cell.