ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date distinguish (https://www.excelbanter.com/excel-programming/360192-date-distinguish.html)

hme

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


--
hme
------------------------------------------------------------------------
hme's Profile: http://www.excelforum.com/member.php...o&userid=15930
View this thread: http://www.excelforum.com/showthread...hreadid=537674


Bob Phillips[_6_]

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" wrote in message
...

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




hme

Date distinguish
 

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


Bob Phillips[_6_]

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" wrote in message
...

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




hme

Date distinguish
 

Thanks Bob

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

Thanks again
hm

--
hm
-----------------------------------------------------------------------
hme's Profile: http://www.excelforum.com/member.php...fo&userid=1593
View this thread: http://www.excelforum.com/showthread.php?threadid=53767



All times are GMT +1. The time now is 03:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com