+ Reply to Thread
Results 1 to 4 of 4

Deleting rows from a list that contain a time later than a certain point

  1. #1
    Registered User
    Join Date
    08-23-2014
    Location
    Boston
    MS-Off Ver
    2013
    Posts
    5

    Deleting rows from a list that contain a time later than a certain point

    Hey guys,

    There must be a way to do this. I have a table and each row has a time column in the format of HH:MM:SS AM/PM. I want to be able to remove (delete) lines that contain a time that's later (and if possible, earlier) than a selected time/timeframe. Here's what I've tried:


    Please Login or Register  to view this content.
    My aim is to filter all but cells that contain anything within 7PM and then delete those visible cells. I think my issue is with the syntax of specifying a range of time. Can anybody help out?

    Thanks

    MT
    Last edited by alansidman; 08-24-2014 at 11:43 AM. Reason: code tags added

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,705

    Re: Deleting rows from a list that contain a time later than a certain point

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Deleting rows from a list that contain a time later than a certain point

    Hi MT,

    The key to AutoFilter dates in VBA is to understand how dates are stored internally by Excel. Dates are stored as the number of days since a start date a long time ago, and as fractions of a day. For example, the approximate current date and time '8/29/2014 3:49:34 PM ' is stored internally as 41880.6594175926. When doing an Autofilter comparison the dates must be converted to type 'Double'.

    See the attached file which contains the following code:
    Please Login or Register  to view this content.
    Lewis

  4. #4
    Registered User
    Join Date
    08-23-2014
    Location
    Boston
    MS-Off Ver
    2013
    Posts
    5

    Re: Deleting rows from a list that contain a time later than a certain point

    Thanks, great method

+ 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. Deleting a number of separate rows at the same time
    By nemmi69 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-21-2013, 10:42 AM
  2. Help with deleting rows according to time value
    By vpnvipin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-02-2012, 06:10 AM
  3. Run-time error 13 - Problem deleting rows
    By Macster in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-05-2009, 03:51 AM
  4. Deleting rows to a defined point
    By Tim Green in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-21-2006, 12:00 PM
  5. [SOLVED] deleting mutliple rows in different ranges at same time
    By HeatherO in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-14-2005, 10:06 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