Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Im trying to write a simple macro with a checkbox, so when i click a checkbox a number is added to another number. So for example when i select a checkbox i want the number 5 to be added to a number in another cell on my spreadsheet. Thankyou |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Place a checkbox from the control toolbox toolbar
double click on the checkbox and it will take you to the Click event Private Sub CheckBox1_Click() End Sub You can put your code he Private Sub CheckBox1_Click() if not isnumeric(Range("A1").Value) then exit sub if CheckBox1.Value = True then Range("A1").Value = Range("A1").Value + 5 else Range("A1").Value = Range("A1").Value - 5 end if End Sub Adjust the code to perform the functionality you actually require. No go back to excel and in the control toolbox toolbar, make sure the button in the upper left hand corner is not depressed (take you out of design mode). -- Regards, Tom Ogilvy "cjupiter" wrote in message ... Hi, Im trying to write a simple macro with a checkbox, so when i click a checkbox a number is added to another number. So for example when i select a checkbox i want the number 5 to be added to a number in another cell on my spreadsheet. Thankyou |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Try this If CheckBox1.Value = True Then Range("A1").Value = (Range("a1").Value + Range("a2").Value) End If First place a checkbox called checkbox1 in your sheet, double click on the box and insert this snip of code. You can change the range values to suit or change the range prior to the equals sign to place the result in another cell. Regards Kev *** Sent via Developersdex http://www.developersdex.com *** |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks guys. Much helpful :)
"cjupiter" wrote: Hi, Im trying to write a simple macro with a checkbox, so when i click a checkbox a number is added to another number. So for example when i select a checkbox i want the number 5 to be added to a number in another cell on my spreadsheet. Thankyou |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
need a simple code | Excel Programming | |||
Simple Code Help | Excel Programming | |||
simple code | Excel Programming | |||
Help With Very Simple Code | Excel Programming | |||
Some simple code | Excel Programming |