Steve
Premium Member
Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
|
Im trying to do a VBScript in Excel that updates a Cell in Excel when an ActiveX Checkbox is checked, i.e. if its ticked say for instance cell B7 increases its number by 1
Any ideas i cant quite get it?
|
Chris Bingham
Member
Registered: 30th Mar 02
Location: In Scotland
User status: Offline
|
Ok, this is how I just did it.
When you create a checkbox, right click it and select properties.
In the properties menu, you will see an option for 'Linked Cell'
type in a cell location. When the box is checked, TRUE appears in the linked cell location.
Then I would do an IF statement to say for example =if(A1=TRUE,1,0)
The do a sum of all your output cells - all the checked ones should have a 1, all non checked will have a 0. So when a new one is checked, it will increment by one.
[Edited on 04-06-2004 by Chris Bingham]
|
Steve
Premium Member
Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
|
wher do i put this if statement?
|
HeNdie
Member
Registered: 8th May 04
Location: Wigan. Drives:Saxo VTR!
User status: Offline
|
do a macro.
|
Chris Bingham
Member
Registered: 30th Mar 02
Location: In Scotland
User status: Offline
|
You will need an IF statement for each of the outputs so that it turns the output from TRUE to 1.
|
Chris Bingham
Member
Registered: 30th Mar 02
Location: In Scotland
User status: Offline
|
quote: Originally posted by HeNdie
do a macro.
A macro to do what? Put in rubbish answers on posts?
|
Steve
Premium Member
Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
|
im trying to a macro but cant do it, im not sure of the commands
|
HeNdie
Member
Registered: 8th May 04
Location: Wigan. Drives:Saxo VTR!
User status: Offline
|
instead of a checking box, have a tick box, when the tick box is clicked instead of checked, it does the macro, of what u want to happen, ie a box loses a number or somet.
|
Steve
Premium Member
Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
|
ok iv got it to flick a cell (H30) from 0 to 1 when i check or uncheck a box, now i have another check box and i want it to add or subtract to the figure in H30 when i check or uncheck the box?
|
Steve
Premium Member
Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
|
sorry i am using tick boxs, they are called check boxs in excel
|
Chris Bingham
Member
Registered: 30th Mar 02
Location: In Scotland
User status: Offline
|
quote: Originally posted by GSiSteve
ok iv got it to flick a cell (H30) from 0 to 1 when i check or uncheck a box, now i have another check box and i want it to add or subtract to the figure in H30 when i check or uncheck the box?
Have a column which has all the 1's and 0's and then do a sum to add the totals.
|
blebo
Member
Registered: 18th Apr 02
User status: Offline
|
In VB
If Range("??") = True then
cells("??").formular1c1 = Range("??") + 1
else
end if
|