Results 1 to 4 of 4

Thread: Search a row of dates

  1. #1

    Thread Starter
    Fanatic Member JCScoobyRS's Avatar
    Join Date
    Oct 2002
    Location
    Some Mountain in Colorado
    Posts
    677

    Search a row of dates

    I have a row of dates and I need to be able to search it for a value and when that value is encountered, I need to get the cell in which the value was found. Can someone help? Thanks, Jeremy
    He who listens well, speaks well.

  2. #2
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697
    One way is to have a text box that you enter the date you're searching for and then use something like...

    Code:
    Dim CurrentRow As Interger
    oXLApp.Worksheets("Sheet1").Select
    objExcel.Range("A1").Select
    Do Until objExcel.ActiveCell.Value = Text1 
    objExcel.ActiveCell.Offset(1, 0).Select
    Loop
    
    CurrentRow = objExcel.ActiveCell.Row

  3. #3
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    How about a loop....
    VB Code:
    1. For i = 1 To 100 'Or whatever...
    2.    If InStr(1, Range("$A$" & i).Value, Date) Then
    3.       Range("$A$" & i).Select
    4.          Exit For
    5.    End If
    6. Next

    Just a thought, untested code btw....

  4. #4
    Addicted Member
    Join Date
    Aug 2003
    Location
    houston
    Posts
    185
    Public Sub datefind()
    Dim sCell As Range




    For Each sCell In Selection
    If IsDate(sCell.Value) Then MsgBox (sCell.Value) ' STORE IN ARRAY OR PLACE ON SPREAD
    Next
    End Sub

Posting Permissions

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



Click Here to Expand Forum to Full Width