Consulting

Results 1 to 5 of 5

Thread: Finding "Today"

  1. #1
    VBAX Regular
    Joined
    Feb 2005
    Posts
    6
    Location

    Finding "Today"

    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.

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    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.
    [VBA]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[/VBA]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Regular
    Joined
    Feb 2005
    Posts
    6
    Location

    Finding today

    Thanks very much, Lucas. that has got me started!

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Let us know if this works out. Post here again if you have any problems.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    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.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

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