Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Refer to controls by group name.

I have a userfrom that functions as an employee evaluation. There are
several areas of evaluation that I have assigned option buttons to.
There are four option buttons to each criteria. When the user is done
evaluating I want to verify that each criteria has been evaluated.
What I have works but it is repetitive and seems like there should be
a more efficient way to achieve my desired results. Is there a way to
check if all optionbuttons in a group are false? Below is my code.
Any help would be appreciated.

sub verify()
If opt1.Value = False And opt2.Value = False And opt3.Value = False
And opt4.Value = False Then
GoTo 2
ElseIf opt5.Value = False And opt6.Value = False And
opt7.Value = False And opt8.Value = False Then
GoTo 2
ElseIf opt9.Value = False And opt10.Value = False And
opt11.Value = False And opt12.Value = False Then
GoTo 2
ElseIf opt13.Value = False And opt14.Value = False And
opt15.Value = False And opt16.Value = False Then
GoTo 2
ElseIf opt17.Value = False And opt18.Value = False And
opt19.Value = False And opt20.Value = False Then
GoTo 2
End If
exit sub
2: msgbox "Please verify that the evaluation is complete."
end sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Refer to controls by group name.

Dim op as Control
for each op in Userform1.Controls
if typeof op is Msforms.OptionButton then
if op.value then cnt = cnt + 1
end if
Next
if cnt < 5 then
msgbox "Please verify that the evaluation is complete."
end if

--
Regards,
Tom Ogilvy


"stewart" wrote:

I have a userfrom that functions as an employee evaluation. There are
several areas of evaluation that I have assigned option buttons to.
There are four option buttons to each criteria. When the user is done
evaluating I want to verify that each criteria has been evaluated.
What I have works but it is repetitive and seems like there should be
a more efficient way to achieve my desired results. Is there a way to
check if all optionbuttons in a group are false? Below is my code.
Any help would be appreciated.

sub verify()
If opt1.Value = False And opt2.Value = False And opt3.Value = False
And opt4.Value = False Then
GoTo 2
ElseIf opt5.Value = False And opt6.Value = False And
opt7.Value = False And opt8.Value = False Then
GoTo 2
ElseIf opt9.Value = False And opt10.Value = False And
opt11.Value = False And opt12.Value = False Then
GoTo 2
ElseIf opt13.Value = False And opt14.Value = False And
opt15.Value = False And opt16.Value = False Then
GoTo 2
ElseIf opt17.Value = False And opt18.Value = False And
opt19.Value = False And opt20.Value = False Then
GoTo 2
End If
exit sub
2: msgbox "Please verify that the evaluation is complete."
end sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Refer to controls by group name.

is there a way to show which control launches the message box i tried
op.setfocus but it comes up with object not defined

Dim op as Control
for each op in Userform1.Controls
if typeof op is Msforms.OptionButton then
if op.value then cnt = cnt + 1
end if
Next
if cnt < 5 then
op.setfocus
msgbox "Please verify that the evaluation is complete."
end if

On Apr 26, 3:06 pm, Tom Ogilvy
wrote:
Dim op as Control
for each op in Userform1.Controls
if typeof op is Msforms.OptionButton then
if op.value then cnt = cnt + 1
end if
Next
if cnt < 5 then
msgbox "Please verify that the evaluation is complete."
end if

--
Regards,
Tom Ogilvy

"stewart" wrote:
I have a userfrom that functions as an employee evaluation. There are
several areas of evaluation that I have assigned option buttons to.
There are four option buttons to each criteria. When the user is done
evaluating I want to verify that each criteria has been evaluated.
What I have works but it is repetitive and seems like there should be
a more efficient way to achieve my desired results. Is there a way to
checkif all optionbuttons in agroupare false? Below is my code.
Any help would be appreciated.


sub verify()
If opt1.Value = False And opt2.Value = False And opt3.Value = False
And opt4.Value = False Then
GoTo 2
ElseIf opt5.Value = False And opt6.Value = False And
opt7.Value = False And opt8.Value = False Then
GoTo 2
ElseIf opt9.Value = False And opt10.Value = False And
opt11.Value = False And opt12.Value = False Then
GoTo 2
ElseIf opt13.Value = False And opt14.Value = False And
opt15.Value = False And opt16.Value = False Then
GoTo 2
ElseIf opt17.Value = False And opt18.Value = False And
opt19.Value = False And opt20.Value = False Then
GoTo 2
End If
exit sub
2: msgbox "Please verify that the evaluation is complete."
end sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Group a range - closing the group does not hide the controls.... [email protected] Excel Programming 0 April 21st 07 04:53 AM
Ref a Group of Controls Abdul[_2_] Excel Programming 2 September 24th 06 05:49 PM
Group controls stefantem[_13_] Excel Programming 3 January 11th 06 12:36 PM
How to refer to controls by string Darren Hill[_2_] Excel Programming 3 January 27th 04 03:29 AM
Group Controls Jack D[_2_] Excel Programming 1 January 20th 04 03:27 AM


All times are GMT +1. The time now is 01:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"