+ Reply to Thread
Results 1 to 6 of 6

Clear ALL combo Box

  1. #1
    Registered User
    Join Date
    06-08-2008
    Posts
    36

    Clear ALL combo Box

    Hi,

    How do I clear all combobox at one time?

    Now i am clearing it one by one and i forsee that if i have alot of combobox, this list will go a long way..

    Please Login or Register  to view this content.
    Last edited by jieyi; 03-13-2009 at 05:10 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Clear ALL combo Box

    Hello jieyi,

    This macro will clear all ComboBoxes (Control Toolbox type) on the active sheet provided you haven't changed the name from "ComboBox" and they are not loaded using the ListFillRange property.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor Tarball's Avatar
    Join Date
    04-21-2007
    Location
    Atlanta, GA
    Posts
    166

    Re: Clear ALL combo Box

    Here is another spin on the same method. This assumes that you have named your controls in a defined manner such as: lstMyList_1, lstMyList_2, etc..

    Please Login or Register  to view this content.
    And you can combine this method and the one above as follows:

    Please Login or Register  to view this content.
    Last edited by Tarball; 03-11-2009 at 03:55 PM.
    Reach me at excel_help at bellsouth dot net

  4. #4
    Registered User
    Join Date
    06-08-2008
    Posts
    36

    Re: Clear ALL combo Box

    Somehow it didn't clear....

    my ComboBox is named as "zebra_ComboBox1, zebra_ComboBox2, ..."

    So i used to use this code
    Please Login or Register  to view this content.
    somehow it didn't clear all my combobox.. all the items are still in there.

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Clear ALL combo Box

    You need to check the first 14 characters of the name for a match

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Clear ALL combo Box

    Hello jieyi,

    This is similar to Andy's suggestion. Instead of using the Left string operator, the LIke operator is used to do a partial match. This approach offers more flexibility for comparisons.
    Please Login or Register  to view this content.

+ 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