Consulting

Results 1 to 5 of 5

Thread: Based on combobox key word - toogle visibility of other Comboboxes

  1. #1
    VBAX Newbie
    Joined
    Mar 2019
    Posts
    5
    Location

    Based on combobox key word - toogle visibility of other Comboboxes

    Hi,
    In Word 2013 - I'm trying to find a key word in a Combobox then based on the outcome, toggling the visibility of others...trying this code...no good...help! Thank you.

    Private Sub ComboBox4_Change()
    If Me.ComboBox4.Value <> "Unintentional" Then
    Me.ComboBox5.Visible = False
    Me.ComboBox6.Visible = False
    Me.ComboBox7.Visible = False
    Me.ComboBox8.Visible = False
    Me.ComboBox9.Visible = False
    Me.ComboBox10.Visible = False
    Else
    Me.ComboBox5.Visible = True
    Me.ComboBox6.Visible = True
    Me.ComboBox7.Visible = True
    Me.ComboBox8.Visible = True
    Me.ComboBox9.Visible = True
    Me.ComboBox10.Visible = True
    End If
    End Sub
    Last edited by CraigP; 03-31-2019 at 05:04 AM.

  2. #2
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,335
    Location
    Seems to be fine here:

    Private Sub ComboBox1_Change()
      If ComboBox1.Value <> "Unintentional" Then
        ComboBox2.Visible = False
        ComboBox3.Visible = False
        ComboBox4.Visible = False
      Else
        ComboBox2.Visible = True
        ComboBox3.Visible = True
        ComboBox4.Visible = True
      End If
    End Sub
    
    Private Sub UserForm_Initialize()
      With ComboBox1
        .AddItem "A"
        .AddItem "b"
        .AddItem "Unintentional"
      End With
    End Sub
    Are you triggering the event?
    Greg

    Visit my website: http://gregmaxey.com

  3. #3
    VBAX Newbie
    Joined
    Mar 2019
    Posts
    5
    Location
    Sorry Greg, I followed your code ... no go. What trigger do you expect...is it the change to the cb coz that is the private sub call. Thanks for your time.
    cheers, Craig

  4. #4
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,335
    Location
    CraigP,

    Yes, I meant is the trigger occurring? If you put a stop in the code and change the value in the combobox, does the code run? I you want, attach your document and I will look at it.
    Greg

    Visit my website: http://gregmaxey.com

  5. #5
    VBAX Newbie
    Joined
    Mar 2019
    Posts
    5
    Location
    It does trigger when I change the cb but it gives an error at the first cb to be hidden...mmm

Tags for this Thread

Posting Permissions

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