+ Reply to Thread
Results 1 to 6 of 6

VBA Excel - Multiple Combobox - Set Blank = "All" (epoiezam)

  1. #1
    Registered User
    Join Date
    09-23-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    14

    VBA Excel - Multiple Combobox - Set Blank = "All" (epoiezam)

    Hi again guys:

    In a bit of a jammed here,
    Again this is the best site I turn to, for help.
    I paste down my script below for your easy viewing. (it's a sample, overall I have 10 comboboxes)

    I don't have any prob when all of the comboboxes are selected (not equal to blank). it works beautifully.
    But when I leaved some blank. Then the filter doesn't worked.

    Thank you in advance for your kind help.


    last = Cells(Rows.Count, 4).End(xlUp).Row
    For i = last To 1 Step -1
    If Cells(i, 4).Value = combo1 And Cells(i, 5).Value = Combo2 And Cells(i, 6).Value = combo3 Then
    Cells(i, 4).Select
    Range(Cells(i, 3), Cells(i, 24)).Select
    Selection.Copy
    nextrow = Range("z5000").End(xlUp).Row + 1
    Cells(nextrow, 26).Select
    ActiveSheet.Paste
    Application.CutCopyMode = False

    End If
    Next i

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

    Re: VBA Excel - Multiple Combobox - Set Blank = "All" (epoiezam)

    Try changing your And's to Or's.
    David
    (*) Reputation points appreciated.

  3. #3
    Registered User
    Join Date
    09-23-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: VBA Excel - Multiple Combobox - Set Blank = "All" (epoiezam)

    Hi Tinbendr:

    First.. Thank you so much for responding.
    In this scenario, I need "blank" to equal to "All"
    Is that possible ?

    Sample of required outcome in Table A below:-

    If:
    Combo1 = Matured Adult (A3)
    Combo2 = "Blank" (A4)
    Combo3 = MASS (A5)

    When Combo2 "blank", it will display all values (column A4)
    Same goes with the rest of the combos. If no value selected ("blank").
    It will read as "All".


    Table A

    A3 A4 A5
    1 Matured Adult A MASS
    2 Matured Adult A MASS
    3 Matured Adult B MASS
    4 Matured Adult B MASS
    5 Matured Adult C MASS
    6 Matured Adult C MASS



    Thanks again Tinbendr

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: VBA Excel - Multiple Combobox - Set Blank = "All" (epoiezam)

    Instead of

    Please Login or Register  to view this content.
    you could do
    Please Login or Register  to view this content.
    This might cause problems if possible values for combo1 etc have ?, *, or # as characters.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: VBA Excel - Multiple Combobox - Set Blank = "All" (epoiezam)

    A more robust test, that won't be effected by special characters would be


    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    09-23-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: VBA Excel - Multiple Combobox - Set Blank = "All" (epoiezam)

    Woooo mikerickson.. that works perfectly...

    Thank you, Thank you so much..

    Tinbendr, Thank you.

    You guys are the best..

+ 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. [SOLVED] Keeping particular cell blank if the related cells show "0" or "blank"
    By Anuru in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-24-2014, 05:30 AM
  2. = EMBED("Forms.ComboBox.1","") error "Reference not valid."
    By CatharinaCatharina in forum Excel General
    Replies: 2
    Last Post: 12-11-2014, 09:58 AM
  3. Excel 2010 - Return date (MMM) from "multiple cells" otherwise blank
    By acopa00 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-23-2014, 10:52 AM
  4. [SOLVED] i have multiple lookup in my excel, its give result "0" i want blank outpu.
    By vengatvj in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-25-2013, 02:05 PM
  5. Replies: 2
    Last Post: 06-06-2013, 12:45 PM
  6. Replies: 3
    Last Post: 02-16-2011, 02:55 PM
  7. Replies: 3
    Last Post: 12-14-2006, 01:36 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