Results 1 to 7 of 7

Delete Rows Based on Time criteria

Threaded View

  1. #1
    Registered User
    Join Date
    01-30-2012
    Location
    Hasselt, Belgium
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    4

    Delete Rows Based on Time criteria

    Hi,

    I'm trying to solve a problem i have with my macro code for deleting entire rows when cell values in column V
    are between 23:00:00 and 08:00:00 o'clock. The cells in column V are formatted as 'time' and the number of rows in the sheet
    must be able to change.

    The code worked fine for another
    similar sheet with time criteria between 19:00:00 and 08:00:00. I can't seem to figure out what the problem is here..

    The code i have right now is:

    Sub Delete_rows

    Sheets("New").Select

    For i = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1
    If Cells(i, "V") > "23:00:00" And Cells(i, "V") < "8:00:00" Then
    ActiveSheet.Cells(i, "A").EntireRow.Delete
    Cells(i - 1, 1).Select
    End If
    Next i

    End Sub

    Can anyone help me with this one?

    Thanks a lot!
    Last edited by Roelandu; 01-30-2012 at 11:12 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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