PC Review


Reply
Thread Tools Rate Thread

How can I make a sheet display data from another sheet based on date criteria?

 
 
CW
Guest
Posts: n/a
 
      11th May 2007
Hello,

Say I have an Excel workbook with 3 sheets (sheet1, sheet2, sheet3).

Each sheet has two columns (Date, Thing that happened on that date).

I would like to know if there's a way to have a fourth sheet, called
"on this date in history" (or whatever). It would consider today's
date and display each thing that happened on todays date in previous
years on each row.

So basically, if I open the workbook on May 11th, 2007 and go to the
fourth sheet, it would show me a list list of events that happened on
May 11th in previous years, and it would update for each day that I
view it. Then when I add rows to sheets 1, 2, and 3, it would update
on the fourth sheet.

Furthermore, it would be great if there could be a third column on
the "on this date in history sheet" that displays the name of the
sheet that the data in each row was taken from.

I understand that this would require the use of an Auto_Open macro
and some VB code. Any help on this would be greatly appreciated!
Thank you.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?QUtwaGlkZWx0?=
Guest
Posts: n/a
 
      12th May 2007
In the 4th Sheet in Cell A1 type =TODAY()
In Cell A2 type Date
Set up a Worksheet Activate Event under VBA
Code could be as followed. I do not know the ranges or worksheet names so
you'll have to insert those yourself.


Dim wb As Worksheet

For Each wb in Worksheets

If Worksheet.Name = "Sheet4" Then
End Sub
Else

Range("A1").Activate
Do Until ActiveCell.Value = ""
If ActiveCell.Value = Sheets("Sheet4").Range("A1").Value Then
ActiveCell.Offset(0,1).Copy
Sheets("Sheet4").Select
Range("A1").End(xlDown).Offset(1,0).PasteSpecial
Else Endif

Loop

Next wb

EndSub

I haven't really tested it, but if you understand VBA well you can solve
your way around the problems and get it to work. Basically its saying each
time you enter Sheet 4 to look through Sheets 1 through 3 for Todays date,
then copy the cell next to the date and paste it in to Sheet 4. Let me know

> Hello,
>
> Say I have an Excel workbook with 3 sheets (sheet1, sheet2, sheet3).
>
> Each sheet has two columns (Date, Thing that happened on that date).
>
> I would like to know if there's a way to have a fourth sheet, called
> "on this date in history" (or whatever). It would consider today's
> date and display each thing that happened on todays date in previous
> years on each row.
>
> So basically, if I open the workbook on May 11th, 2007 and go to the
> fourth sheet, it would show me a list list of events that happened on
> May 11th in previous years, and it would update for each day that I
> view it. Then when I add rows to sheets 1, 2, and 3, it would update
> on the fourth sheet.
>
> Furthermore, it would be great if there could be a third column on
> the "on this date in history sheet" that displays the name of the
> sheet that the data in each row was taken from.
>
> I understand that this would require the use of an Auto_Open macro
> and some VB code. Any help on this would be greatly appreciated!
> Thank you.
>
>
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help: auto-copy entire rows from 1 sheet (based on cell criteria) to another sheet. bertbarndoor Microsoft Excel Programming 4 5th Oct 2007 04:00 PM
Move data to new sheet - rename sheet based on criteria ? Michael.Ray.Pennington@gmail.com Microsoft Excel Misc 7 16th May 2007 10:22 PM
Copy data from sheet 1 to sheet 2 based on day/date jonpdavies@gmail.com Microsoft Excel Programming 7 1st Oct 2005 04:59 PM
data fill sheet 2 from sheet 1 based on criteria FDDavis Microsoft Excel Misc 7 8th Apr 2004 10:26 PM
Moving Data from one sheet to a different sheet based on Criteria DoctorV Microsoft Excel Discussion 7 24th Mar 2004 08:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:51 PM.