+ Reply to Thread
Results 1 to 6 of 6

Userform: Make a advanced filter script "filter" when a combobox is altered

  1. #1
    Registered User
    Join Date
    03-25-2009
    Location
    Sweden
    MS-Off Ver
    Excel 2003
    Posts
    49

    Userform: Make a advanced filter script "filter" when a combobox is altered

    Hey!

    Completly new to VBA and macro in general.

    Trying to build a small Userform Program that is gonna search in a worksheet depending on what i choose in my diffrent comboboxes and then return some valuves (havent got to that point yet so not important now)

    There is proberly alot better and smother ways to do this then how im trying to do it (and ofcourse you can come with suggestions)

    My problem now tho is that I start the program and im gonna decide on a Dimension. lets say i choose 2". Then im gonna choose Type

    And heres the thing, i only want to show the diffrent "types" that you can get in the dimension 2". And the only way i could come up with this was using excels advanced filter.


    Two problem occur when using this script


    First, when i start with choosing Dimension i then have to click my "Add" button to paste it in the Advanced filter criteria i have in my workbook and then press filterbutton to acctually filter my "database".

    Second, When i use a Advanced filter script to make this work and "filter on place" my options in my boxes after dimension dosent change since my comboboxes is still looking for my information in the same cells and with the advanced filter those cells is only hidden. I know how to copy the filter to another cell with a macro but i dont know the "script code" to do this. Can anyone help out on this?

    For my first problem is there any code to make this work on altering the cell?

    Feel free to come with suggestions on how i can make filtering databases with a better method then advanced filter script or just help out with code as the script is now.
    Attached Files Attached Files

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,202

    Re: Userform: Make a advanced filter script "filter" when a combobox is altered

    have a look at this
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    03-25-2009
    Location
    Sweden
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Userform: Make a advanced filter script "filter" when a combobox is altered

    Quote Originally Posted by royUK View Post
    have a look at this
    This is gonna help me to put up my code in a better way.
    It dosent do (atleast what i can see) what i wanna accomplish.

    To copy and filter on another place in the sheet. So that in the following boxes the list i get up is dependent on what i choosed in my first criteria (Dimension)

    Also the other thing that i wanna get rid of. Im trying to get around the need to press my filter button to do the filtering. What i want is when i choose a certain dimension. it instantly filter my database without me pressing the filterbutton. This is to make it smother with actually filter out whats gonna be shown in my second and third combobox

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,202

    Re: Userform: Make a advanced filter script "filter" when a combobox is altered

    Use the ComboBox change event to change the form. You should be able to adapt the code to use advanced filter, or simply copy the Filtered range to another range.

  5. #5
    Registered User
    Join Date
    03-25-2009
    Location
    Sweden
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Userform: Make a advanced filter script "filter" when a combobox is altered

    Quote Originally Posted by royUK View Post
    Use the ComboBox change event to change the form. You should be able to adapt the code to use advanced filter, or simply copy the Filtered range to another range.
    Gonna take a deeper look into it. The problem as it is i basicly have no VBA experiance as it is

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,202

    Re: Userform: Make a advanced filter script "filter" when a combobox is altered

    Quote Originally Posted by Zheno View Post
    Gonna take a deeper look into it. The problem as it is i basicly have no VBA experiance as it is
    Have a go then post back for help

+ 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