+ Reply to Thread
Results 1 to 6 of 6

SELECTING CURRENT DATE AT OPENING

  1. #1
    R VAN DEURSEN
    Guest

    SELECTING CURRENT DATE AT OPENING

    I have a worksheet with the dates of a month, say 1jan,
    2jan, 3jan etc. Is there a way that excel by opening the
    workbook selects automaticely the current date.

  2. #2
    Bob Phillips
    Guest

    Re: SELECTING CURRENT DATE AT OPENING

    Private Sub Workbook_Open()
    Worksheets(Format(Date, "dmmm")).Activate
    End Sub

    in the ThisWorkbook code module.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "R VAN DEURSEN" <[email protected]> wrote in message
    news:[email protected]...
    > I have a worksheet with the dates of a month, say 1jan,
    > 2jan, 3jan etc. Is there a way that excel by opening the
    > workbook selects automaticely the current date.




  3. #3
    Guest

    Re: SELECTING CURRENT DATE AT OPENING

    Thank you,

    this one is usable to, what i mean is, selecting
    automaticely a cell with the current date
    >-----Original Message-----
    >Private Sub Workbook_Open()
    > Worksheets(Format(Date, "dmmm")).Activate
    >End Sub
    >
    >in the ThisWorkbook code module.
    >
    >--
    >
    >HTH
    >
    >RP
    >(remove nothere from the email address if mailing direct)
    >
    >
    >"R VAN DEURSEN" <[email protected]>

    wrote in message
    >news:[email protected]...
    >> I have a worksheet with the dates of a month, say 1jan,
    >> 2jan, 3jan etc. Is there a way that excel by opening

    the
    >> workbook selects automaticely the current date.

    >
    >
    >.
    >


  4. #4
    Peter Rooney
    Guest

    RE: SELECTING CURRENT DATE AT OPENING

    How about this, assuming that you give the name "SearchDates" (for example)
    to the range of cells containing your dates.

    Sub FindCurrentDateCell()

    Dim SearchCell As Object

    For Each SearchCell In Range("SearchDates")
    If SearchCell.Value = Date Then
    SearchCell.Select
    Exit Sub
    End If
    Next SearchCell
    End Sub

    Hope this helps

    Pete



    Sub FindCurrentDateCell()

    Dim SearchCell As Object

    For Each SearchCell In Range("SearchDates")
    If SearchCell.Value = Date Then
    SearchCell.Select
    Exit Sub
    End If
    Next SearchCell
    End Sub


    "R VAN DEURSEN" wrote:

    > I have a worksheet with the dates of a month, say 1jan,
    > 2jan, 3jan etc. Is there a way that excel by opening the
    > workbook selects automaticely the current date.
    >


  5. #5
    Peter Rooney
    Guest

    RE: SELECTING CURRENT DATE AT OPENING

    Sorry, I forgot you wanted to run it whenever the workbook opened!

    Paste this code into the code window of your "ThisWorkbook" in the Visual
    Basic Editor. make sure you don't change the procedure name, otherwise it
    won't work.

    Private Sub Workbook_Open()

    Dim SearchCell As Object

    For Each SearchCell In Range("SearchDates")
    If SearchCell.Value = Date Then
    SearchCell.Select
    Exit Sub
    End If
    Next SearchCell
    End Sub

    In this way, the code will run whenever you open the workbook. I'm sure you
    know, but you can also have similar macros called:
    Private Sub Workbook_Close() which runs when the workbook closes, or

    Private Sub Worksheet_Activate() or
    Private Sub Worksheet_Deactivate()

    in the code windows of your worksheets to run when a worksheet is activated
    or deactivated.

    Hope this helps

    Pete





    "R VAN DEURSEN" wrote:

    > I have a worksheet with the dates of a month, say 1jan,
    > 2jan, 3jan etc. Is there a way that excel by opening the
    > workbook selects automaticely the current date.
    >


  6. #6
    Guest

    RE: SELECTING CURRENT DATE AT OPENING

    thank you,

    this works great
    >-----Original Message-----
    >How about this, assuming that you give the

    name "SearchDates" (for example)
    >to the range of cells containing your dates.
    >
    >Sub FindCurrentDateCell()
    >
    > Dim SearchCell As Object
    >
    > For Each SearchCell In Range("SearchDates")
    > If SearchCell.Value = Date Then
    > SearchCell.Select
    > Exit Sub
    > End If
    > Next SearchCell
    >End Sub
    >
    >Hope this helps
    >
    >Pete
    >
    >
    >
    >Sub FindCurrentDateCell()
    >
    > Dim SearchCell As Object
    >
    > For Each SearchCell In Range("SearchDates")
    > If SearchCell.Value = Date Then
    > SearchCell.Select
    > Exit Sub
    > End If
    > Next SearchCell
    >End Sub
    >
    >
    >"R VAN DEURSEN" wrote:
    >
    >> I have a worksheet with the dates of a month, say

    1jan,
    >> 2jan, 3jan etc. Is there a way that excel by opening

    the
    >> workbook selects automaticely the current date.
    >>

    >.
    >


+ Reply to 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