locked
Filter Data with Date range.Dates are selected in user form RRS feed

  • Question

  • Does anybody could help me to create a user form, that user could select the date and time from either calendar or other control button (from Userform control Toolbox) and the VBA code would filter the data on Excel SpreadSheet depending on input...

    I want user to specify start time and the end time, that I would know the period of time which is on interest and filter the data depending on inputs...

    This is part of my table on Sheet1:

    ID                     Time

     

      Products

    ProdNoExit

    8 04-06-2013 23:00 15 1
    8 04-06-2013 23:30 205 1
    8 05-06-2013 00:00 235 1
    8 05-06-2013 00:30 587 1
    8 05-06-2013 01:00 874 1
    8 05-06-2013 01:30 155 1
    8 05-06-2013 02:00 150 1
    8 05-06-2013 02:30 258 1
    Friday, December 19, 2014 10:31 AM

Answers

All replies

  • The calendar control is a) no longer available in the newer versions of Office and b) not suitable because it does not support times.

    Here is a sample file with ComboBoxes:

    https://dl.dropboxusercontent.com/u/35239054/Samples/67fdfc82-5711-404d-9a27-2783cc6f1129.xlsm

    Andreas.

    Friday, December 19, 2014 12:18 PM
  • How about this?

    Right-click your tab name, and paste this code into the window that opens.

    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub
    If Target.Address = "$A$1" Or _
        Target.Address = "$G$1" Then
      Range("Database").AdvancedFilter _
        Action:=xlFilterInPlace, _
          CriteriaRange:=Range("Criteria"), Unique:=False
    End If
    End Sub


    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    Monday, December 29, 2014 8:22 PM