+ Reply to Thread
Results 1 to 5 of 5

Hide Combobox based on Cell Value

  1. #1
    Registered User
    Join Date
    04-02-2010
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    62

    Hide Combobox based on Cell Value

    Hi,

    Im looking for VB code to hide a combo box based on the value of a cell.

    For example if the user inputs a value of 100% or leaves blank I want the combo box below to be hidden.

    Thanks

  2. #2
    Registered User
    Join Date
    04-02-2010
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    62

    Re: Hide Combobox based on Cell Value

    Any help would be greatly appreciated!

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Hide Combobox based on Cell Value

    Hi savio21,

    See the attached. It all comes down to making the visible property on the combobox false or not, depending on the value in a cell.

    I've put code behind the UserForm Activate that will check the value in A1 (you can change it to any cell) and it will hide or unhide the ComboBox based on that value.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    04-02-2010
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    62

    Re: Hide Combobox based on Cell Value

    It didnt quite work. I inserted a combobox instead of a data validation list into the excel workbook. How do I hide the combobox if its built into the worksheet instead of a user form? Also, as a follow up the name for the combobox appears to be Drop Down 12. Do I need to rename the box so it doesn't contain any spaces or can i use underscores?

    Thanks

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Hide Combobox based on Cell Value

    Hi savio21,

    I didn't know your combobox was on the sheet itself. If it is on the sheet it is a "Shapes".

    I put one on Sheet1 and then went to the immediate window and did:
    debug.print Application.Worksheets(1).Shapes(1).Name and pressed enter. I tried "Shapes(2)" until I got a ComboBox. Then I added it to the attached code. Try the new version. I think you well see how it works.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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