+ Reply to Thread
Results 1 to 5 of 5

Date distinguish

  1. #1
    Registered User
    Join Date
    11-01-2004
    Posts
    37

    Date distinguish

    Hi every body

    How does excel destinguish what date is today?

    I use Excel as a scheduling program.
    I have my daily schedule In sheet1 with the the tasks and the the duration (Start date and finish date)

    I would like to have a macro to be able to distinguish what date is today and copy all the tasks which are planned just for today in sheet1 (in Colomn A) and past them in column A in sheet2.For e.g. I would like to see the tasks for 01/05/2006 in another sheet.

    Thk
    hme

  2. #2
    Bob Phillips
    Guest

    Re: Date distinguish

    Today's date is the Date function in VBA, so you would just do something
    like

    For this_row = 1 To last_row_number
    If Cells(this_row,"A").Value = Date Then
    j = j + 1
    Cells(this_row,"A").Copy Worksheets("Sheet2").Range("A" & j)
    End If
    Next this_row

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "hme" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi every body
    >
    > How does excel destinguish what date is today?
    >
    > I use Excel as a scheduling program.
    > I have my daily schedule In *sheet1* with the the tasks and the the
    > duration (Start date and finish date)
    >
    > I would like to have a macro to be able to distinguish what date is
    > today and copy all the tasks which are planned just for today in sheet1
    > (in Colomn A) and past them in column A in sheet2.For e.g. I would like
    > to see the tasks for 01/05/2006 in another sheet.
    >
    > Thk
    > hme
    >
    >
    > --
    > hme
    > ------------------------------------------------------------------------
    > hme's Profile:

    http://www.excelforum.com/member.php...o&userid=15930
    > View this thread: http://www.excelforum.com/showthread...hreadid=537674
    >




  3. #3
    Registered User
    Join Date
    11-01-2004
    Posts
    37
    Thank for prompt reply

    I did not understand.

    Requester Macro should find today date in sheet1 where there is all the date from 1/1/2006 to 31/12/2006 and correspond task.

    Later the task shoud be copy to sheet2.

    thk

    hme

  4. #4
    Bob Phillips
    Guest

    Re: Date distinguish

    Sub CopyData()
    Dim this_row As Long
    Dim last_row_number As Long
    Dim start_date As Date
    Dim end_date As Date
    Dim j As Long

    start_date = DateSerial(2006, 1, 1)
    end_date = DateSerial(2006, 12, 31)
    last_row_number = Cells(Rows.Count, "A").End(xlUp).Row
    For this_row = 1 To last_row_number
    If Cells(this_row, "A").Value >= start_date And _
    Cells(this_row, "A").Value <= end_date Then
    j = j + 1
    Rows(this_row).Copy Worksheets("Sheet2").Range("A" & j)
    End If
    Next this_row
    End Sub


    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "hme" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Thank for prompt reply
    >
    > I did not understand.
    >
    > Requester Macro should find today date in sheet1 where there is all the
    > date from 1/1/2006 to 31/12/2006 and correspond task.
    >
    > Later the task shoud be copy to sheet2.
    >
    > thk
    >
    > hme
    >
    >
    > --
    > hme
    > ------------------------------------------------------------------------
    > hme's Profile:

    http://www.excelforum.com/member.php...o&userid=15930
    > View this thread: http://www.excelforum.com/showthread...hreadid=537674
    >




  5. #5
    Registered User
    Join Date
    11-01-2004
    Posts
    37
    Thanks Bob

    I tried what you suggested and it is working very well.

    Thanks again
    hme

+ 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