PDA

View Full Version : Finding "Today"



HarryB
07-06-2006, 09:56 AM
I have a spreadsheet with a different row for each day. At the start of each row in column A I have: =IF(B559=$A$1,"TODAY","")) [A1 has simply =today()] and then in Column B the date (B559=6/7/2006, B560 is 7/7/2006 etc). Column A is conditionally formatted to show today's date in red. But I would also like a button that would automatically go to today's row, not to A1.

Grateful for any ideas.:hi:

lucas
07-06-2006, 10:31 AM
This might give you a start in the right direction. I didn't adjust it to your requirements but I think you can follow it ok.
Option Explicit
Sub GoToFnd()
Dim c As Range, FirstFound As String
Set c = Range("A:A").Find(what:=[C1], after:=[A1])
FirstFound = c.Address
c.Activate
Do Until MsgBox("Look for next", vbYesNo) = vbNo
Set c = Range("A:A").Find(what:=[C1], after:=c)
If c.Address = FirstFound Then
MsgBox "No more " & [C1]
Exit Sub
End If
c.Activate
Loop
End Sub

HarryB
07-11-2006, 02:02 PM
Thanks very much, Lucas. that has got me started!

lucas
07-11-2006, 02:13 PM
Let us know if this works out. Post here again if you have any problems.

lucas
07-11-2006, 02:31 PM
Harry, note the code I gave you will error if it doesn't find todays date in column A......just in case that happened and you didn't know what was going on.