Consulting

Results 1 to 3 of 3

Thread: Best (and smart) way to do ListBox Filter

  1. #1
    VBAX Regular
    Joined
    Oct 2011
    Posts
    10
    Location

    Best (and smart) way to do ListBox Filter

    Hi Everyone, my first post here!
    First of all sorry about my English, and, yes! im a macro newbie.

    Im doing a project to do a dynamically report using filters.
    These filters will be make using various listbox (5~7). The user will select a option in a listbox and the report will refresh automatically, select other option in other listbox and then refresh again.... and go...

    Im dont have the code yet (im thinking now about the code), but im thinking how i do that...
    I think about a module (procedure) to apply various autofilters (Worksheets("").Range("A1").Autofilter bla bla bla), and after each user selection ill refresh the worksheet (using change event from listbox), but im releasing this idea because how can i do when user release the filter from one listbox? Store every filter in array and apply everyone again?
    I thinked about Advanced Filtering, but, i dont know how to use and in my point isnt the better way...
    So... im here to ask for help, im trying to obtain a "better way" from you... expert`s...

    Thanks in advance.

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Lipse
    Welcome to VBAX
    Can you post a workbook with your layout etc. and sample data, also what you are looking for in the way of a report. Use Manage Attachments in the GoAdvanced reply section.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Regular
    Joined
    Oct 2011
    Posts
    10
    Location

    Thx for Quick Reply!

    Hi mdmackillop, Thx for quick reply!
    Im attached at this post a example (not the original base, because im building it) for what i wanna do.
    A Worksheet, that comboboxes will be used to select data for filtering (like autofilter).
    This is my ideas:

    1) Build Worksheet with "RAW" Data
    2) Sort This Worksheet
    3) Apply Unique constraint for all columns and rows, and put result in other Worksheet
    4) Set RowSource for each combobox according each specified (unique) column.
    5) When user change (i will use the event) a combobox, the selected filter will be applied to other sheet having a report, using as base the RAW Data.

    The resumed ideia is...
    - Create Raw data Worksheet
    - Filter Raw data using combo boxes
    - Execute functions (like count and sum)
    - Show results in report Worksheet

    Do you understand?

    Thanks in advance... Again.
    Attached Files Attached Files

Posting Permissions

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