+ Reply to Thread
Results 1 to 2 of 2

Using a dropdown list as a filter criteria for VBA

  1. #1
    Registered User
    Join Date
    10-19-2021
    Location
    Orléans, France
    MS-Off Ver
    365
    Posts
    4

    Question Using a dropdown list as a filter criteria for VBA

    Hello everyone !!

    In order to help my team at work, I'm trying to add some VBA in our files.
    Each month, we have a powerpoint presentation to do, which means lots of exports, filters, copy/paste but also potential errors due to the number of operations by hand etc
    The datas we are interested in come from exports so the main goal of my macros is to filter, copy/paste datas from one worksheet to another (In the same Workbook).
    These datas contain Reference, names, dates, status

    In my workbook, i have 3 macros that I activate with buttons:
    1- filter and copy/paste datas from sheet 2 to sheet 1 (using AutoFilter)
    2- clear the table (erase datas in sheet 1 for aesthetic purpose)
    3- clear filters (remove autofilter applied in sheet 2)

    What I'm currently trying to achieve:

    I would like to use a dropdown list as a filter criteria in VBA:

    My goal is to be able to filter Creation Dates in sheet 2 following this method:
    1- select month in dropdown list in sheet 1
    2- launch macro with button in sheet 1
    3- having the month selected in the dropdown list used as a criteria in a function like AutoFilter in my VBA macro

    As an example I made this Workbook, the datas have no particular meaning but all 3 macros are functionnal.
    Extract button will filter 2 types of "Bill Statuts" in Sheet 2 and return the datas I want in Sheet 1.
    For the date filter, I would like to filter months only (1 to 12), on my export in Sheet 2 the dates are displayed as dd/mm/yyyy
    However, If I filter the Creation date column in sheet 2, it displays months names directly (from january to july)

    I also made the dropdown list already, it goes from 1 to 12 but you can make it go from "January" to "December" (text) too if that helps (months names are also displayed in the workbook I attached).

    I heard of combobox but it's not what I'm looking for, sorry.
    I think that's it, as a french fellow I hope I made myself clear enough and that my english is OK, thanks a lot for reading and for your time !
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Using a dropdown list as a filter criteria for VBA

    A little set up,
    Sheet1 N2 and M2 needs a date formula reference the month selected.

    2022-07-20_7-24-39.jpg


    You may have to change the date format in the formula to your date format on your computer
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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. Filter Table Based on Dropdown List
    By philchi in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-26-2021, 07:07 PM
  2. Auto filter from Dropdown List
    By Rewmer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-28-2021, 11:50 AM
  3. Search (Filter) Dropdown list
    By mike2246 in forum Excel General
    Replies: 12
    Last Post: 07-31-2020, 11:57 PM
  4. Dropdown list that can apply a filter.
    By 03staylo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2016, 06:50 AM
  5. How To Filter List Using Dropdown Function
    By marcosolvs in forum Excel General
    Replies: 1
    Last Post: 07-11-2014, 06:43 PM
  6. How can I use a dropdown list to filter my data?
    By migdad in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-09-2012, 03:35 PM
  7. Filter data using dropdown list options
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-02-2010, 05:06 AM

Tags for this Thread

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