Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Check for "CheckBox"
I have a Uerform that has "CheckBoxes" and I would like to check and see
which is true so I can enter some data into a cell. The check boxes are listed as SunCheckbox, MonCheckBox, and so on. The example I am sending is just a simple example and the letter "n" is to repersent the check box name. Example: For c = 1 to 7 n = Format(c, "ddd") & "CheckBox" If n = True Then Activecell.Offset(0, c+1) = 1 Next c I hope you can understand what I am trying to do. Thanks, ek |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Check for "CheckBox"
Option Explicit
Private Sub CommandButton1_Click() Dim CBXCtr As Long Dim CBXName As String For CBXCtr = 1 To 7 CBXName = Format(CBXCtr, "ddd") & "CheckBox" If Me.Controls(CBXName).Value = True Then ActiveCell.Offset(0, CBXCtr + 1).Value = 1 Else 'shouldn't you have this, too? 'ActiveCell.Offset(0, CBXCtr + 1).Value = 0 End If Next CBXCtr End Sub ekreider wrote: I have a Uerform that has "CheckBoxes" and I would like to check and see which is true so I can enter some data into a cell. The check boxes are listed as SunCheckbox, MonCheckBox, and so on. The example I am sending is just a simple example and the letter "n" is to repersent the check box name. Example: For c = 1 to 7 n = Format(c, "ddd") & "CheckBox" If n = True Then Activecell.Offset(0, c+1) = 1 Next c I hope you can understand what I am trying to do. Thanks, ek -- Dave Peterson |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Check for "CheckBox"
Dave,
Thanks for the help I knew it was simple but I just couldn't get the right combonation. There is more to the code then what I wrote I just needed to check to see if the check box was true. Thank you verry much, ek "Dave Peterson" wrote: Option Explicit Private Sub CommandButton1_Click() Dim CBXCtr As Long Dim CBXName As String For CBXCtr = 1 To 7 CBXName = Format(CBXCtr, "ddd") & "CheckBox" If Me.Controls(CBXName).Value = True Then ActiveCell.Offset(0, CBXCtr + 1).Value = 1 Else 'shouldn't you have this, too? 'ActiveCell.Offset(0, CBXCtr + 1).Value = 0 End If Next CBXCtr End Sub ekreider wrote: I have a Uerform that has "CheckBoxes" and I would like to check and see which is true so I can enter some data into a cell. The check boxes are listed as SunCheckbox, MonCheckBox, and so on. The example I am sending is just a simple example and the letter "n" is to repersent the check box name. Example: For c = 1 to 7 n = Format(c, "ddd") & "CheckBox" If n = True Then Activecell.Offset(0, c+1) = 1 Next c I hope you can understand what I am trying to do. Thanks, ek -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
when a "check box" is checked, a "result" to be shown in another c | Excel Discussion (Misc queries) | |||
Check if cells contain the word "Thailand", return "TRUE" | Excel Worksheet Functions | |||
how to make a checkbox usable for users to "check" it? | Excel Discussion (Misc queries) | |||
How can I check the "P" or "A" in the attendance sheet | Excel Worksheet Functions | |||
create links to check boxes marked "good" fair"and "bad" | Excel Worksheet Functions |