Userform & checkbox

G

Graham

Hi there

I have a userform and have added a check box to it. I will have a list of
items to be checked/not checked. I have a command button on the form to
process the selections.
What code do I need to check whether a check box is ticked or not.?

Thanks in advance for any help.
Graham
 
D

Doug Robbins - Word MVP

The .Value attribute of a checkbox will return True if it is checked and
False if it is not. Therefore, you would use

If [checkboxname].Value = True Then
'Code to do what you want to do in this case
Else
'Code to do what you want do do in thsi case, if any
End if

If you do not need anything done if it is false, you can omit the Else part
of the If...End If construction

You need to replace

[checkboxname]

with the actual name that you have given to the checkbox.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
G

Graham

Hi Doug

Thanks for that just what I wanted to know.

Graham

Doug Robbins - Word MVP said:
The .Value attribute of a checkbox will return True if it is checked and
False if it is not. Therefore, you would use

If [checkboxname].Value = True Then
'Code to do what you want to do in this case
Else
'Code to do what you want do do in thsi case, if any
End if

If you do not need anything done if it is false, you can omit the Else part
of the If...End If construction

You need to replace

[checkboxname]

with the actual name that you have given to the checkbox.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Graham said:
Hi there

I have a userform and have added a check box to it. I will have a list of
items to be checked/not checked. I have a command button on the form to
process the selections.
What code do I need to check whether a check box is ticked or not.?

Thanks in advance for any help.
Graham
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top