Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checkbox connection with Macro
Hello,
I have a sheet with about 60 questions. Each question has a 4 checkboxes that stand for: NA, OK, F, CAT. I need the user to be able to click a checkbox and another sheet in the workbook to log that answer. The second sheet, named "Middle Sheet", is set up that Column A has all of the questions and Column B will have the response from the checkboxes. I only need the first letter (N, O, F, C) to be placed in column B. If anyone knows how I could do this that would be great. Thanks, Kyle |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checkbox connection with Macro
Have you tried using the Checkbox_Click() event?
"kyle" wrote: Hello, I have a sheet with about 60 questions. Each question has a 4 checkboxes that stand for: NA, OK, F, CAT. I need the user to be able to click a checkbox and another sheet in the workbook to log that answer. The second sheet, named "Middle Sheet", is set up that Column A has all of the questions and Column B will have the response from the checkboxes. I only need the first letter (N, O, F, C) to be placed in column B. If anyone knows how I could do this that would be great. Thanks, Kyle |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checkbox connection with Macro
I have not, how would I use that?
thanks "crazybass2" wrote: Have you tried using the Checkbox_Click() event? "kyle" wrote: Hello, I have a sheet with about 60 questions. Each question has a 4 checkboxes that stand for: NA, OK, F, CAT. I need the user to be able to click a checkbox and another sheet in the workbook to log that answer. The second sheet, named "Middle Sheet", is set up that Column A has all of the questions and Column B will have the response from the checkboxes. I only need the first letter (N, O, F, C) to be placed in column B. If anyone knows how I could do this that would be great. Thanks, Kyle |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checkbox connection with Macro
Kyle,
Assuming Checkbox1, Checkbox2, Checkbox3, Checkbox4 are the checkboxes for the first question (N,O,F,C repectively), then the following code (added to the module of the sheet the checkboxes are on) will place the answer for the last checked box (1-4) into cell B1 on the "Middle Sheet" sheet. Private Sub CheckBox1_Click() If CheckBox1.Value Then Sheets("Middle Sheet").Range("B1") = "N" End Sub Private Sub CheckBox2_Click() If CheckBox2.Value Then Sheets("Middle Sheet").Range("B1") = "O" End Sub Private Sub CheckBox3_Click() If CheckBox3.Value Then Sheets("Middle Sheet").Range("B1") = "F" End Sub Private Sub CheckBox4_Click() If CheckBox4.Value Then Sheets("Middle Sheet").Range("B1") = "C" End Sub The problem with checkboxes is you can make multiple checks (ie. the user can select all four answers) There are ways around this. The below code will uncheck the other three checkboxes when Checkbox2 is checked. Private Sub CheckBox2_Click() If CheckBox2.Value Then Sheets("Middle Sheet").Range("B1") = "O" Checkbox1.value = false Checkbox3.value = false Checkbox4.value = false End Sub However, given that you have 240 checkboxes (60 questions, 4 answers) this will yield a bunch of code. You may want to use a combobox for your answers rather than four checkboxes. Mike "kyle" wrote: I have not, how would I use that? thanks "crazybass2" wrote: Have you tried using the Checkbox_Click() event? "kyle" wrote: Hello, I have a sheet with about 60 questions. Each question has a 4 checkboxes that stand for: NA, OK, F, CAT. I need the user to be able to click a checkbox and another sheet in the workbook to log that answer. The second sheet, named "Middle Sheet", is set up that Column A has all of the questions and Column B will have the response from the checkboxes. I only need the first letter (N, O, F, C) to be placed in column B. If anyone knows how I could do this that would be great. Thanks, Kyle |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
always recheck data connection library for latest connection strin | Excel Discussion (Misc queries) | |||
Help with connection macro? | Excel Discussion (Misc queries) | |||
internet connection via excel macro | Excel Programming | |||
using a password to in connection with macro protectio | Excel Programming | |||
sql connection in macro | Excel Programming |