View Single Post
  #4   Report Post  
Chris Bode Chris Bode is offline
Member
 
Location: Sweden
Posts: 30
Default

Add a command button from the control box on the sheet. Double click the button to open the code window and paste following codes
Code:
Private Sub CommandButton1_Click()
    Dim row As Integer, col As Integer
    row = 1
    col = 1
    
    Dim tmp As Date
    tmp = CDate("March 08 1990")
    While Sheet1.Cells(row, col).Value < ""
        If Sheet1.Cells(row, col + 2).Value = "cross country skiing" And CDate(Sheet1.Cells(row, col).Value)  tmp Then
            tmp = CDate(Sheet1.Cells(row, col).Value)
        End If
        row = row + 1
    Wend
    
    MsgBox "Latest date=" & tmp
End Sub
Now execute the codes and check the result


Chris
------
Convert your Excel spreadsheet into an online calculator.
http://www.spreadsheetconverter.com