+ Reply to Thread
Results 1 to 4 of 4

Use a userform to pass values from combo box to autofilter with custom filter for dates

  1. #1
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Use a userform to pass values from combo box to autofilter with custom filter for dates

    Hi all,

    I'm trying to make a userform that will use an autofilter to show up a person with the dates choosen in date from to date to.
    So this will be 3 comboboxes. 1 for the person name, 2 for the date from and 3 for the date to. So if some one wants to see for Peter 01/10/2013 till 05/10/2013, it will show only those records in the excel sheet.
    The next plan would be to fill in those records (from column H) with the selection from the 4th combobox.
    Could be that I want to mark for peter that he is on a sick leave from the 05/10/2013 till 12/10/2013
    Combobox1= Peter Him, Combobox2= 05/10/2013, Combobox3= 12/10/2013, Combobox4= Sick Leave

    I did this macro below for the autofilter, but I have no clue how to implement this with a userform.
    Please Login or Register  to view this content.
    Any help would be great :-)

    Greetings.

  2. #2
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Use a userform to pass values from combo box to autofilter with custom filter for date

    Hi all,

    To make things easier I have added a workbook with a userform attached.
    When you press the edit data button, you get an userform. It has 4 comboboxes and a OK and exit button.
    The idea is that when you click on the edit data button you will be able to select a person, choose the date from, choose the date to and the reason. the only thing that will be filled in by the userform is the reason in column E. Maybe it is better to say that when you select the person and the dates, it will create a range for that person in the chosen dates and only fill column E with whatever the choice was.
    In the workbook I have added a sick leave period from the 12th 11 till the 19th 11 for Jesica Poter.

    Any ideas getting this going?

    Greetings.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Use a userform to pass values from combo box to autofilter with custom filter for date

    Hi all,

    I have a problem passing a value from a cell into the custom filter in autofilter.
    Can some one pleases look at the below code and let me know where I go wrong? (the criteria for field 2 works as it should).

    Please Login or Register  to view this content.
    Thank you in advance.

    Greetings.
    Last edited by Megatronixs; 10-29-2013 at 08:26 AM.

  4. #4
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Use a userform to pass values from combo box to autofilter with custom filter for date

    Hi all,

    I figured out what is goin on. There is a problem with the custom autofilter. When the first criteria is passed in column 2 all goes OK.
    When I pass the second criteria from the custom filter with dates, it seems not to see the format (dd/mm/yyyy) and the rows are empty. When I run the macro step by step and when getting to the custom filter part and change it manually, it will work. Do I somthing wrong? is there a problem with the format? mabye I should pass somehow the format in the criteria1 and criteria2 from the field 1. I'm lost as much as it can.

    Any help will get me out of this crazy situation.

    Greetings.

+ 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] Autofilter Custom Filter VBA
    By FLani in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-18-2013, 04:30 AM
  2. Pass Date value from custom calendar control to Userform Combo Box:
    By rvc81 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-23-2013, 12:59 AM
  3. Pass a simple value from custom UserForm to VBA module
    By MSieg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-23-2012, 04:25 AM
  4. filter from combo box? (not autofilter)
    By Excel idiot in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-19-2007, 05:31 PM
  5. Pass Combo Values to an ODBC Parameter........
    By Jonathan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-23-2005, 08:05 AM

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