+ Reply to Thread
Results 1 to 11 of 11

Drop downs & filters

  1. #1
    Registered User
    Join Date
    12-16-2008
    Location
    Channel Islands
    Posts
    6

    Drop downs & filters

    Hi,

    First post so please excuse me if this has been covered before but I am trying to get the results of a dropdown menu in one worksheet to become the criteria for a filter in another worksheet (both in teh same workbook).

    I thought I could just add a reference to the dropdown cell into the autofilter (in VBA editor) but it doesn't seem to be that simple.

    Any ideas?

    Thanks for the help.
    Last edited by VBA Noob; 01-02-2009 at 09:02 AM.

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

    Please Login or Register  to view this content.
    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
    12-16-2008
    Location
    Channel Islands
    Posts
    6
    Thats great! I will give it a go and see how it works.

    Thanks again for your help.

  4. #4
    Registered User
    Join Date
    12-16-2008
    Location
    Channel Islands
    Posts
    6
    Sorry for taking so long to actually try this but now I have I seem to be having some problems.

    On the last line of the code I keep getting a message "Compile error: expected end of statement" highlighting the field part of the statement, like this:

    Sheet2.UsedRange.AutoFilter Field:=3, Criteria1:=sCrit

    Any ideas or am I just being thick?

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Have you got a Field 3 in your workbook/ Try attaching the workbook

  6. #6
    Registered User
    Join Date
    12-16-2008
    Location
    Channel Islands
    Posts
    6
    Quote Originally Posted by royUK View Post
    Have you got a Field 3 in your workbook/ Try attaching the workbook
    It isn't the Field 3 that is a problem (I don't think).

    I tried changing the field number but it keeps coming up with the error message highlighting the word "Field" and not getting as far as the reference.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    It would be easier to see the workbook.

    Is is picking p the criteria correctly?

  8. #8
    Registered User
    Join Date
    12-16-2008
    Location
    Channel Islands
    Posts
    6
    Quote Originally Posted by royUK View Post
    It would be easier to see the workbook.
    Sorry, had to do a bit of tidying up before I posted it.

    I am trying to get the auto filters on the Master List sheet to work off the drop down lists on the Frontsheet.
    Attached Files Attached Files

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You can use the worksheet change event to trigger he code. Like this

    Please Login or Register  to view this content.

    To add this code to your worksheet, do the following:

    Copy the code above
    Select Frontsheet's tab
    Right click on the sheet tab and choose View Code, to open the Visual Basic Editor.
    Where the cursor is flashing, choose Edit | Paste

  10. #10
    Registered User
    Join Date
    12-16-2008
    Location
    Channel Islands
    Posts
    6
    Thank you - you are a star!

  11. #11
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

+ 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