Closed Thread
Results 1 to 14 of 14

Go to today's date column

  1. #1
    Registered User
    Join Date
    04-04-2004
    Posts
    42

    Go to today's date column

    HI,
    I have columns labeled with various dates.
    How can I have excel go to the column with todays date when the sheet is opened?
    Thanks,
    Bobby

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,


    Enter this code in the sheet with the dates

    Please Login or Register  to view this content.
    Assumes Date in Column A

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    04-04-2004
    Posts
    42
    Thanks for the quick reply.
    I'm really not very good at this VBA thing yet (very interested though).
    O.K. so I put the code into the sheet, saved and re-opened. But I couln't get it to work.
    My dates are at the top of the columns, not in rows. So I'm thinking the code as written may be for the dates being in rows?
    Thanks

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Try the below. Right click the sheet tab with the dates then select View code
    Paste the below into VB and close.

    Select a different sheet. then reselect the sheet with the dates.

    Assumes dates are in Row 1 this time

    Please Login or Register  to view this content.
    VBA Noob

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Example attached

    VBA Noob
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-04-2004
    Posts
    42
    Still no go.
    Is this line O.K?
    SearchOrder:=xlByRows

  7. #7
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Did the example work

    VBA Noob

  8. #8
    Registered User
    Join Date
    04-04-2004
    Posts
    42
    Not yet,
    I must be doing something wrong. How do I get it to select the column with today's date?

  9. #9
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Argh,

    I was selecting the cell and you want the column

    Try

    Please Login or Register  to view this content.
    VBA Noob

  10. #10
    Registered User
    Join Date
    04-04-2004
    Posts
    42

    O.K. Thanks, it works

    Great,
    It's working. Thanks so much for the help.
    I'm leaving now but will play with it some more tomorrow.
    Appreciate the help...this stuff is fun.
    Bobby

  11. #11
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    No problem

    Thanks for the feedback

    VBA Noob

  12. #12
    Forum Contributor
    Join Date
    07-19-2010
    Location
    Huddersfield, UK
    MS-Off Ver
    Excel 2007, 2010
    Posts
    167

    Re: Go to today's date column

    Apologies for the necro, but I'm trying to do the same thing - only my dates are in column B, and are not in any formula. I need to run this macro to find todays date whenever run (or clicked, if a button can be added somehow?)

    I've tried:


    Please Login or Register  to view this content.
    ...and looked at the example sheet, but when I go into Macro (Alt+F8) to run it, there is nothing there to run... This is the first time I've properly tried to use/make any macro, so I need baby-instructions please

    Thanks
    Last edited by dancing-shadow; 11-04-2011 at 03:48 PM.

  13. #13
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Go to today's date column

    ... so I need baby-instructions ...
    :
    #1. Please read forum rule #2
    #2. Start your own thread
    Ben Van Johnson

  14. #14
    Forum Contributor
    Join Date
    07-19-2010
    Location
    Huddersfield, UK
    MS-Off Ver
    Excel 2007, 2010
    Posts
    167

    Re: Go to today's date column

    Quote Originally Posted by protonLeah View Post
    :
    #1. Please read forum rule #2
    #2. Start your own thread
    Apologies - used to another forum where they'd rather same questions go in the same thread, rather than having 200 seperate threads all asking the same things... Makes searching for answers easier if it's all in one thread, rather than having to trawl through loads... Different strokes for different folks...
    New thread started.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1