+ Reply to Thread
Results 1 to 2 of 2

Autofilter to display results between start time and stop time

  1. #1
    Registered User
    Join Date
    01-15-2015
    Location
    USA
    MS-Off Ver
    2013
    Posts
    18

    Autofilter to display results between start time and stop time

    Hello all,

    I seem to have hit a roadblock with my progress so I plea to the experts for help. I have a list where ticks happen and the time they happened is recorded. I am working on some code to count the number of ticks per hour. So:

    tick 0500
    tick 0502
    tick 0612

    The macro would output to another worksheet:

    0500-0559 2
    0600-0659 1
    0700-0759 0 and so on for the entire 24 hours

    maybe my idea is not the best but I am wanting to use a loop and the autofilter to display 0500 to 0559 times, count the rows, next... 0600 to 0659, count, next, 0700 to 0759, etc.

    However, when I try criteria1:="5:**" I get zero results. I have tried several different ways utilizing the "*" wildcard to no avail. I also tried criteria1:=">=5" which alone displays everything above 0500. When I toss in a criteria2:="<6" I get zero results. If I manually go to autofilter and type 5* or 5:** it filters perfectly. Macro recorder ends up having every result in a criteria1 array which is no help. I tried doing a criteria1: "4" & array(":01", ":02", etc) which gave me error 13 type mismatch. How can I get the vba to do this.

  2. #2
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Autofilter to display results between start time and stop time

    Date and time formats cause us all problems because what we see is not what Excel sees and like you say it works when you manually filter but not when you appear to be asking the same question via VBA. It's all smoke and mirrors!!

    It would be easier if you post your workbook highlighting which column you are trying to filter
    To do this click on Reply, then GoAdvanced , then look below for ManageAttachments etc

    thanks
    If a response has helped then please consider rating it by clicking on *Add Reputation below the post
    When your issue has been resolved don't forget to mark the thread SOLVED (click Thread Tools at top of thread)

+ 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. Start stop time in excel
    By superchew in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 08-17-2013, 10:51 AM
  2. [SOLVED] Start Time and Stop Time: Disable End Button If Cell Is Blank
    By FLani in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-22-2013, 09:20 AM
  3. Replies: 3
    Last Post: 03-27-2012, 01:07 PM
  4. Replies: 1
    Last Post: 02-23-2012, 09:01 AM
  5. display end time automatically upon entering start time and time usage
    By stoey in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-19-2008, 06:16 PM
  6. Start/Stop Time counter
    By SVTF in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-19-2008, 07:38 PM
  7. [SOLVED] How can I get elapsed time between AM start/PM stop
    By khacmac in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-01-2005, 08:06 PM

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