+ Reply to Thread
Results 1 to 4 of 4

Cursor To be positioned on a cell containing the current date

  1. #1
    Registered User
    Join Date
    09-26-2012
    Location
    Blackpool, England
    MS-Off Ver
    Excel 2002
    Posts
    3

    Cursor To be positioned on a cell containing the current date

    I currently use Excel 2002 at work and I have a bit of a conundrum. I wondered if it was possible to make the cursor appear on the cell that contains the current date whatever that may be. Someone at work was kind enough to provide the following, but my VBA knowledge is very limited. (I did try contacting the person but after three days have not heard anything). I have tried putting the code into the VBA Module and also on to the VBA Sheet, but nothing appears to work.

    Private Sub Workbook_Open()

    Application.Goto Reference:="R2C1"

    'get todays date
    dte = Date

    'select the sheet that contains the dates
    Sheets("sheet1").Select

    'select the first cell that contains a date
    Range("A2").Select

    'check if the cell is before todays date
    While ActiveCell.Value < dte
    'scroll down the page (for across use offset(0,1)
    ActiveCell.Offset(0, 1).Select
    'there are no more dates to check so stop
    If ActiveCell.Row > 500 Then Exit Sub
    Wend
    'we went one too far so go back up one
    'ActiveCell.Offset(-1, 0).Select

    End Sub

    I have two spreadsheets one with the dates running across from A2 to Z2, the other the dates are running down column B from B2 to B500. TIA

  2. #2
    Forum Contributor
    Join Date
    07-27-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    198

    Re: Cursor To be positioned on a cell containing the current date

    See if these macros will help. They test OKAY in Excel 2003.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-26-2012
    Location
    Blackpool, England
    MS-Off Ver
    Excel 2002
    Posts
    3

    Re: Cursor To be positioned on a cell containing the current date

    To xLJer,
    Thanks for your help. The macros did appear to work at home. I will try them out at work tomorrow. I don't want to be pedantic, but is it possible to get the macros to run on opening the spreadsheets?

  4. #4
    Forum Contributor
    Join Date
    07-27-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    198

    Re: Cursor To be positioned on a cell containing the current date

    Copy everything between Sub and End Sub to where you want to use it, each workbook's opening event.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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