PDA

View Full Version : Code VBA checkbox and optionbox



hitmen
02-03-2014, 11:12 AM
HI everyone,

I want to using VBA for run checkbox.

if checkbox 1 = true, listbox1 only appearance value column A and B with column C.value=1 (sheet "Basic")
checkbox 2 = true, listbox1 only appearance value column A and B with column C.value=2 (sheet "Basic")

if optionbox 1 = true, listbox1 only appearance value column A and B with column D.value=1 (sheet "Basic")
optionbox 2 = true, listbox1 only appearance value column A and B with column D.value=2 (sheet "Basic")
optionbox 3 = true, listbox1 only appearance value column A and B with column D.value=3 (sheet "Basic")

Thank you very much

Kenneth Hobs
02-04-2014, 10:51 AM
I would suggest making your logic a bit more clear. Obviously, checkbox 1 and 2 can both be checked so that needs optionboxes too instead I suspect. IF one of the checkboxes are checked, then I would guess that you may then want to include all rows in columns A and B that match both the first set of options boxes and the 2nd set of option boxes criterion.

Another Idea to consider is to let the user select the options from the data in comboboxes. I would do a combobox for the column C and one for the Column D. Those are really easy to do. This would handle the case where later you add another option say 5 for the column D data. That combobox would list 1,2,3,5.

hitmen
02-04-2014, 11:34 AM
I would suggest making your logic a bit more clear. Obviously, checkbox 1 and 2 can both be checked so that needs optionboxes too instead I suspect. IF one of the checkboxes are checked, then I would guess that you may then want to include all rows in columns A and B that match both the first set of options boxes and the 2nd set of option boxes criterion. Another Idea to consider is to let the user select the options from the data in comboboxes. I would do a combobox for the column C and one for the Column D. Those are really easy to do. This would handle the case where later you add another option say 5 for the column D data. That combobox would list 1,2,3,5. Hi Mr Kenneth Hobs, I want to listbox 1 will appearance data column A and B from sheet "Basic" if checkbox 1 and 2 can both be checked it is mean all kind of concentration drug will appearance data column A and B from sheet "Basic" in listbox1 if checkbox 1 = true, only concentration of adult will appearance data column A and B from sheet "Basic" in listbox1 if checkbox 2 = true, only concentration of children will appearance data column A and B from sheet "Basic" in listbox1