Check Box macro

titan2x

New Member
Joined
Sep 27, 2006
Messages
6
Is there a way to create a macro that when a check box is ticked the corresponding value can be entered in another worksheet?
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

titan2x

New Member
Joined
Sep 27, 2006
Messages
6
Lets say I have several values on a spreadsheet that change continously, but I only want one value to be used on another worksheet. So if I create a check box beside all the items and there values so that when the check box is ticked that corresponding value is entered into a desired cell in another worksheet. Can this be done?

i.e

Apples $50.00
Grapes $80.00
Peaches$20.00

So the value of the apples is ticked and the item name and value are entered under a different worksheet. Hope this helps.
 

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
There are two checkbox's that can be placed on a worksheet without using a UserForm. The Control Menu CheckBox and the Forms Menu CheckBox, each codes differently!
Which do you use?

Once again how is the code to know which Sheet and which cell gets the value from the cell with the CheckBox Checked?


The sample below shows the use of both CheckBox types: [The sample adds a strike-through line to the text in the selected cell if the CheckBox is Checked or clears the strike-through.]

The "cbCheck" Sub must be run to work. The other is a Click Event and works automatically!


Sub cbCheck()
'Sheet module code!
'For a "Form CheckBox" used on a sheet.
'This is the assigned macro for that checkbox!
'myClick is the checkbox state indicator!


Static myClick

If myClick = "" Then
'ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
ActiveCell.Select
Selection.Font.Strikethrough = True
myClick = "Yes"
Else
ActiveCell.Select
Selection.Font.Strikethrough = False
myClick = ""
End If
End Sub

Private Sub CheckBox1_Click()
'Sheet module code!
'For a "Control Tool Box CheckBox" used on a sheet.

'Automatically runs code on CheckBox change.

If CheckBox1.Value = -1 Then
'ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
ActiveCell.Select
Selection.Font.Strikethrough = True
Else
Selection.Font.Strikethrough = False
End If
End Sub
 

Forum statistics

Threads
1,141,098
Messages
5,704,319
Members
421,338
Latest member
Pepess

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top