Multiple Check Boxes

irresistible007

Board Regular
Joined
Nov 24, 2005
Messages
173
I have four checkboxes (check1....check4) captioned Apples, Bananas, Grapes, Oranges... and a Text Box (txt1) a "Submit" button and "reset" button...

What i want is the text box to display the caption of items selected, using vbCrLf as values separator, when the submit button is pressed even if the multiple selection is being made
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi irresistible007,

This code ought to do it:

Code:
Private Sub SubmitBtn_Click()
   Txt1.Text = IIf(Check1, Check1.Caption & vbCrLf, "") & _
               IIf(Check2, Check2.Caption & vbCrLf, "") & _
               IIf(Check3, Check3.Caption & vbCrLf, "") & _
               IIf(Check4, Check4.Caption, "")
End Sub

This assumes the submit button is named SubmitBtn.

Similiarly for the Reset button:

Code:
Private Sub ResetBtn_Click()
   Check1 = False
   Check2 = False
   Check3 = False
   Check4 = False
   Txt1.Text = ""
End Sub

And you will need to set the Txt1's MultiLine property to True.

Keep Excelling.

Damon
 
Upvote 0

Forum statistics

Threads
1,224,416
Messages
6,178,503
Members
452,853
Latest member
philipnjk64

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
Back
Top