+ Reply to Thread
Results 1 to 3 of 3

Problem with Option Box disabled if Check Box is not selected

  1. #1
    Registered User
    Join Date
    07-30-2013
    Location
    Norway
    MS-Off Ver
    Excel 2007
    Posts
    3

    Problem with Option Box disabled if Check Box is not selected

    Hi,
    I am trying to disable option button (OptionButtonDropsH) if check box (CheckBoxDrops) is not selected. It works if I "check" and then "uncheck" the check box, but when the form opens initially, the option box is still enabled and can be chosen. My code is below:

    Private Sub CheckBoxDrops_Click()
    If CheckBoxDrops Then
    OptionButtonDropsH.Enabled = True
    Me.lblDropsH.Enabled = True
    Else
    If Not CheckBoxDrops Then
    OptionButtonDropsH.Enabled = False
    Me.lblDropsH.Enabled = False
    End If
    End If
    End Sub

    Any suggestions?
    I tried adding something like below before the code above, but it did not work:

    Private Sub txtActivity_Click()
    Dim objCtrl As Control
    For Each objCtrl In Me.Controls
    If objCtrl.ControlType = acOptionButton Then
    objCtrl.Enabled = False
    End If
    End If
    Next
    End Sub

    Thanks a lot in advance!
    P
    Last edited by npb88; 07-31-2013 at 05:45 AM.

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Problem with Option Box disabled if Check Box is not selected

    change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    David
    (*) Reputation points appreciated.

  3. #3
    Registered User
    Join Date
    07-30-2013
    Location
    Norway
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Problem with Option Box disabled if Check Box is not selected

    So you meant I should add the bottom code on top by changing as you suggested? Tried, lost the function of disabling totally.. Not working
    Also tried changing the initial codes first line to "Private Sub Userform1_Initialize", also did not work..

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Activate Print option with a userform where selected Sheet check box option available..
    By santosh226001 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-03-2013, 08:19 AM
  2. Check Box / Option Button problem in Excel 2010
    By Sofistikat in forum Excel General
    Replies: 7
    Last Post: 09-23-2011, 12:03 AM
  3. Disabled Properties menu option
    By Dooldeniya in forum Excel General
    Replies: 6
    Last Post: 04-09-2009, 04:35 PM
  4. option button disabled
    By raw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-14-2006, 03:00 PM
  5. Why is my sort menu option disabled?
    By Valerie M in forum Excel General
    Replies: 2
    Last Post: 10-20-2005, 05:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1