Greetings,
In my userform I have several frames (Frames 2-6) that are enabled as per the optionbutton selection (enclosed in Frame1). By default the frames (2-6) are disabled. I tried to write a code where if the optionbutton selection changes any frames that have been previously enabled should be disabled before enabling the frame for the current optionbutton selection.
I approached the problem by first identifying the name of the enabled frame using the below procedure.
The correct frame name is returned irrespective of the order in which I click the optionbuttons. However when I add the line![]()
Private Sub NameEnabledFrame() CountFrames For i = 2 To iCountFra Set Fr = Me.Controls("Frame" & i) If Fr.Enabled = True Then sFraName = Fr.Name End If 'Disable all frames to clear memory Fr.Enabled = False Next MsgBox (sFraName) End Sub
after the msgbox statement, the correct frame name is returned & hence the enabling takes place only if I click the optionbuttons in ascending order, ie, 1, 2, 5 etc. If I click optionbutton2 after clicking 5, the message box returns frame6 (corresponding to optionbutton5) with frame6 enabled. Frame3 (corresponding to optionbutton2) does not get enabled.![]()
Me.Controls(sFraName).Enabled = True
Why is this happening? Please help.
Asha
N.B. Frame1 also has a combobox and textbox whose values will not change with a change in optionbutton selection.
Bookmarks