Results 1 to 10 of 10

Thread: Find... >= tDate

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    662
    Rep Power
    15
    Quote Originally Posted by PcMax View Post
    Hi,

    I have a list of dates in ascending order...
    Code:
    03/01/2001
    08/01/2001
    10/01/2001
    13/01/2001
    17/01/2001
    20/01/2001
    Code:
    Sub Test()
        If ActiveSheet.FilterMode = True Then ActiveSheet.ShowAllData
        tDate = CDbl(DateValue([A4].Value)) '<--- Selection.NumberFormat = "m/d/yyyy"
        For Lval = 7 To 25000
            If CDbl(Cells(Lval, 2)) >= tDate Then
                MsgBox Lval
                Exit Sub
            End If
        Next
    End Sub
    Using this code that displays the correct data, it is possible a different solution
    It does not actually display the "correct data", rather, it display the first row number of a date in B7:B2500 that is greater than or equal to the date in A4, if there is one. Here is a shorter bit of code (actually, a one-liner) that should do the same thing...
    Code:
    Sub DateTooLate()
      MsgBox Replace(Evaluate("MIN(IF(B7:B2500>=A4,ROW(B7:B2500),99999))"), 99999, "All OK")
    End Sub
    Last edited by Rick Rothstein; 01-28-2013 at 12:40 PM.

Similar Threads

  1. Replies: 4
    Last Post: 04-05-2013, 12:08 PM

Posting Permissions

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