VBA UserForm with Check Box

jscranton

Well-known Member
Joined
May 30, 2011
Messages
707
I am trying to create a pretty simple UserForm that will contain 4-10 choices that I want end users to select all that apply and then create a text string based on their input. I have browsed the web but nothing seems really clear to me.

Can anyone point me towards resources/step-by-step instructions?

If it matters, this form is going to be displayed by a larger module that will need input from an end user at times. It will not appear on the source excel.

Also, one question I am anticipating is how to display the userform but still allow the source file to be viewed/navigated. In other words, I want to activate the userform but leave the source workbook active as well.

Thanks,

Justin
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,306
Lets talk about this first:
I am trying to create a pretty simple UserForm that will contain 4-10 choices that I want end users to select all that apply and then create a text string based on their input.

So the user will select these choices where?

Do you mean if they select these choices from a Checkbox Caption?
If not explain more.

And you can open a UserForm and still work on your sheet by opening the Userform like this:

UserForm1.Show Modeless
 
Last edited:

jscranton

Well-known Member
Joined
May 30, 2011
Messages
707
My hope is to display a userform with 4-10 check boxes. FWIW, users are reviewing the source workbook and determining if certain data types are present. If they are, I want to them to check the user form check box. I then want to write the check box name ("DOB", "Address", etc) to a string object and store it in an array. Does that answer your question?

THanks for the help.

Justin

PS

Weird to me that I am a "Board Regular" with <700 posts and you are the same with >15,000.
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,306
A UserForm Checkbox only has a true or false value.
If the checkbox is checked it returns a value of true
If not checked it returns a value of False.

Now a Checkbox does have a name such as CheckBox1 and you can rename it.

So your saying your checkboxes will have names Like:

George
5447 Elm street
Gary Indiana
36879

And so if all three are checked you want to create a string like this:

George 5447 Elm street Gary Indiana 36879

Is that what you want?
<strike></strike>
 
Last edited:

jscranton

Well-known Member
Joined
May 30, 2011
Messages
707
Yes, but it won't be as specific as that. It will be:

Address
DOB
State
ID Number
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,306
So the script needs to look at all CheckBoxes on the Userform.

And if they are checked then add the name of the checkbox to the string?

If that true?
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,306
After looking at this:

1. A checkbox cannot be named 5644 Elm Street
CheckBoxes can only be given charter names like Alpha Bravo Charlie
So we would have to use the caption value.

And I would have to loop through all the checkboxes and exactly what way the loop runs is difficult for me to know.

This is beyond my knowledgebase.
I will continue to monitor this thread to see what I can learn.
 

jscranton

Well-known Member
Joined
May 30, 2011
Messages
707
After looking at this:

1. A checkbox cannot be named 5644 Elm Street
CheckBoxes can only be given charter names like Alpha Bravo Charlie
So we would have to use the caption value.

And I would have to loop through all the checkboxes and exactly what way the loop runs is difficult for me to know.

This is beyond my knowledgebase.
I will continue to monitor this thread to see what I can learn.
I do I create a UserForm with two custom checkboxed named "Address" and "DOB"? Start there and we will figure this out.
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
22,814
Rather than a bunch of checkboxes, you could use a multiselect ListBox with the .ListStyle set to fmListStyleOption.
Then you could loop through the list box enteries and see what the user checked.
 

Forum statistics

Threads
1,082,601
Messages
5,366,571
Members
400,902
Latest member
fathima

Some videos you may like

This Week's Hot Topics

Top