Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Delete rows if cell value is greater than a specific time

  1. #11
    Board Regular DanteAmor's Avatar
    Join Date
    Dec 2018
    Location
    México
    Posts
    6,999
    Post Thanks / Like
    Mentioned
    86 Post(s)
    Tagged
    15 Thread(s)

    Default Re: Delete rows if cell value is greater than a specific time

    Quote Originally Posted by Rackette View Post
    Dante, I"m sorry I was unable to answer your question sooner and ended up wasting your time.
    Hi @Rackette, taking advantage of the Trebor code, I adapted it in my code to work and leave a more compact macro.

    Code:
    Sub Delete_Rows()
    Dim lr As Long, i As Long, a, r As Range, exists As Boolean
    Application.ScreenUpdating = False
    lr = Range("D" & Rows.Count).End(xlUp).Row
    Set r = Range("A" & lr + 1)
    a = Range("D2:D" & lr)
    For i = 1 To UBound(a)
      If Len(a(i, 1)) > 0 Then If TimeSerial(Hour(a(i, 1)), Minute(a(i, 1)), 0) < TimeSerial(6, 45, 0) Then Set r = Union(r, Range("A" & i + 1))
    Next i
    r.EntireRow.Delete
    End Sub
    Regards Dante Amor

  2. #12
    New Member
    Join Date
    Jul 2019
    Posts
    37
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Delete rows if cell value is greater than a specific time

    Dante,
    Thank you very much for following up. That does what I need it too, also.
    Everyone on here is always so helpful!

    -Christine

  3. #13
    Board Regular DanteAmor's Avatar
    Join Date
    Dec 2018
    Location
    México
    Posts
    6,999
    Post Thanks / Like
    Mentioned
    86 Post(s)
    Tagged
    15 Thread(s)

    Default Re: Delete rows if cell value is greater than a specific time

    I'm glad to help you. Thanks for the feedback.
    Regards Dante Amor

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •