View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
John Keith John Keith is offline
external usenet poster
 
Posts: 172
Default identify whic row contains todays date

On Fri, 24 Apr 2009 20:03:01 -0700, OssieMac
wrote:

OssieMac,

Thanks, that finds the correct cell with todays date (and I'll only
have one entry for todays date so I don't need the FindNext right
now.)

So if I want to reference the contents of the cell in column C of this
same row how do I address it? cells(?, "C")

Hi John,

Lookup FindNext in Help if you need to find more than one occurrence of
today's date.

Sub FindToday()

Dim dateToday As Date
Dim rngColB As Range
Dim rngToFind As Range

dateToday = Date

With Sheets("Sheet1")
Set rngColB = .Range("B:B")
End With

With rngColB
Set rngToFind = .Find(What:=dateToday, _
After:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
End With
If Not rngToFind Is Nothing Then
'insert your code here in lieu of
'following 2 lines if date found
rngToFind.Select
MsgBox "Found value"
Else
MsgBox "Did not find value"
Exit Sub
End If

End Sub


John Keith