Results 1 to 3 of 3

Thread: select a date

  1. #1
    Star Lounger
    Join Date
    Feb 2001
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    select a date

    Hi,
    I have a spreadsheet (o2k), with column A filled with consecutive dates which will enable users to enter a particular activity in column B they have completed on the day they did it. It is a rolling 6 month activity to remain qualified, and I would like to have the sheet open on the current day; ie today(); to make life easier.The date format is in the form: 08-Jan-01.

    Any thoughts anyone??

    Thankyou.

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: select a date

    Something similar was discussed at <A target="_blank" HREF=http://www.wopr.com/cgi-bin/w3t/showflat.pl?Cat=&Board=xl&Number=22736&page=&view= &sb=&vc=1>This Post</A> so you might like to check it out.

    If your dates are consecutive, and there are no missing dates, then the following might be useful,

    Private Sub Worksheet_Activate()
    Dim StartDay As Date
    Dim NoDays As Integer
    StartDay = Range("A1").Value
    NoDays = Int(Now()) - StartDay
    Range("A1").Offset(NoDays, 0).Select
    End Sub

    Copy the above, right click on the sheet tab you want to use, select View Code, and paste in the main window. Then whenever that sheet is activated it should goto the cell containing the current date. This code assumes the first date is in A1 and consecutive dates are all in column A

    Andrew C

  3. #3
    Star Lounger
    Join Date
    Feb 2001
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: select a date

    Andrew,
    That works just the way I wanted. Thank you very much. I never even came close with my attempts!

    The only snagette, which took a few minutes to figure out, was that I only had one sheet and so the event would not work on opening, although it was perfect with a press of F5. I now have two sheets in the workbook:-))). Perfect!

    Once again, thank you.
    Regards,
    Farside

Posting Permissions

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