Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 6 of 6

Thread: I am really stuck!!

  1. #1
    Board Regular
    Join Date
    Apr 2002
    Posts
    76
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default


    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

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Newcastle, UK
    Posts
    1,174
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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
    "Have a good time......all the time"
    Ian Mac

  3. #3
    Board Regular
    Join Date
    Apr 2002
    Posts
    76
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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...

  4. #4
    Board Regular
    Join Date
    Apr 2002
    Posts
    76
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

  5. #5
    Board Regular
    Join Date
    Apr 2002
    Posts
    76
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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?

  6. #6
    Board Regular
    Join Date
    Apr 2002
    Posts
    76
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •