Sorry the title was meant to be working with multiple frames but I dont know how to edit this
Ive got a userform with 30 frames on it. In each frame there is 5 option buttons with captions 1 2 3 4 and 5)
ive written some code to find out which optionbutton has been chosen for a frame as below
sub commandbutton1_click() Dim objControl As Control For Each objControl In Frame1.Controls If objControl.Value = True Then frame1ans = objControl.Caption Exit For End If Next End Sub
I was wondering if there was a way to alter the code to do this for each frame, rather than typing it out 30 times?
sub commandbutton1_click() For counter1 = 1 To 30 myframe = "Frame" & counter1 myframeresult = "myframeres" & counter1 Dim objControl As Control For Each objControl In myframe.Controls If objControl.Value = True Then myframeresult = objControl.Caption Exit For End If Next Next counter1 end sub
I know this syntax is all wrong but just to give an idea of what im tryign to do
Thanks in advance