I am really stuck!!

buntykins

Board Regular
Joined
Apr 11, 2002
Messages
76
I have two frames on a userform, Frame 2 and Frame 3. When the userform starts up, Frame 3 is disabled, but still visible (E.G: It's light grey and impossible to select). I did this by using the following code:

Dim ctrl As Control
For Each ctrl In Frame3.Controls
ctrl.Enabled = Not ctrl.Enabled
Next

Now what I want to do is when I click commandbutton1, for Frame 2 to become disabled, and frame 3 to become enabled. But what code do I need to put into the commandbutton's click event?

Help me, I'm at my wit's end!! Even my pigtails are going curly!!

Thanks
Janie
xxxx
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
On 2002-04-17 06:33, buntykins wrote:

I have two frames on a userform, Frame 2 and Frame 3. When the userform starts up, Frame 3 is disabled, but still visible (E.G: It's light grey and impossible to select). I did this by using the following code:

Dim ctrl As Control
For Each ctrl In Frame3.Controls
ctrl.Enabled = Not ctrl.Enabled
Next

Now what I want to do is when I click commandbutton1, for Frame 2 to become disabled, and frame 3 to become enabled. But what code do I need to put into the commandbutton's click event?

Help me, I'm at my wit's end!! Even my pigtails are going curly!!

Thanks
Janie
xxxx

I don't think you need to disable the controls within the frame, they should be disabled automatically when the frame is,

you could use

Private Sub CommandButton1_Click()

Frame2.Enabled = False
Frame3.Enabled = True

End Sub
 
Upvote 0
Yeah, that disables the controls, but it doesnt do the same thing as my code. My code actually makes the whole frame and everything in it go light grey, which is what I need it to do. I need it to look un-selectable as well you see. Our users will sit there all day and click it otherwise...
 
Upvote 0
Thanks for trying though! I appreciate it

If you can tell me how to do what I need then I'd be most grateful...

xx
 
Upvote 0
Oooh, I am so close!!!

I'm sure the code in the command button's event must be something like:

Dim ctrl As Control
For Each ctrl In Frame3.Controls
ctrl.Enabled = True
for each ctrl In Frame2.Controls
ctrl.Enabled = True
Next

But it won't work!! Do any of you guys know how I can set it right?
 
Upvote 0
I've done it!! Woo-hoo!!

For Each ctrl In Frame2.Controls
ctrl.Enabled = Not ctrl.Enabled
Next

If you were gonna reply, then thanks

Janie
xxxxxx
 
Upvote 0

Forum statistics

Threads
1,213,483
Messages
6,113,919
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top