Hi all! I am relatively skilled with VBA but cannot find a better way to do this...
I have a userform with 63 frames. Currently I'm transferring my data out with 63 iterations of the following:
For Each ctrl In Frame1.Controls
If ctrl.Value = True Then
home.Offset(j, icol) = ctrl.Caption
End If
Next
j = j + 1
The subsequent lines are for Frame2, Frame 3, etc all the way up to 63. My question is this:
How do I write this so that I can do a larger loop outside of this bit of code to have all 63 in one loop? i have tried variations of the following but I am not dimensioning something correctly.
Do until MyFrame = 63
For each ctrl in "Frame" & MyFrame & ".Controls"
'code to look at each option button
'Next
Loop
Please help direct me towards a more efficient way to do this! Thank you!!
M
I have a userform with 63 frames. Currently I'm transferring my data out with 63 iterations of the following:
For Each ctrl In Frame1.Controls
If ctrl.Value = True Then
home.Offset(j, icol) = ctrl.Caption
End If
Next
j = j + 1
The subsequent lines are for Frame2, Frame 3, etc all the way up to 63. My question is this:
How do I write this so that I can do a larger loop outside of this bit of code to have all 63 in one loop? i have tried variations of the following but I am not dimensioning something correctly.
Do until MyFrame = 63
For each ctrl in "Frame" & MyFrame & ".Controls"
'code to look at each option button
'Next
Loop
Please help direct me towards a more efficient way to do this! Thank you!!
M