Sort by Date and Copy results to another sheet

I'm still working on my little project and can't seem to find what i'm
looking for in any of the forums or help files, I know it can be done
as I did it a college.

using the following data example

Date           Time            Name            details 

11/03/08        17:00           greg             wanted to party
12/03/08        10:55           fred             wanted help
13/03/08        11:45           paul             wanted to speak to
dave
13/03/08        13:30           harry            wanted to go home

I want to leave the data intact and un edited in the main sheet above,
and have a way to find all the data with todays date and copy them to
another sheet at the push of a single button.

So i'd get a report on sheet 3 

13/03/08        11:45           paul              wanted to speak to
dave
13/03/08        13:30           harry             wanted to go home

Any ideas or good places to look for what I need.

Many Thanks




-- 
Pat-UK
0
3/13/2008 10:39:07 AM
excel.newusers 15348 articles. 2 followers. Follow

6 Replies
257 Views

Similar Articles

[PageSpeed] 18

Hi Pat,
The following code should do what you want. It creates a new sheet,
names it with today's date, and then fills in the right info.
Just copy and paste it into a VBA module.
The macro assumes the following:
  That you will run the macro when the sheet containing your info, is
active.
  That the dates to be searched are in column A, starting in row 2.
See comment in code to change this if necessary.
It's untidy, and jumps around while it's working, but it's all I have
time for.
If you want to do this more than once in a day, you have to delete the
new sheet first.
Regards - Dave.

Sub DoWhatPatWants()
A = Day(Now)
B = Month(Now)
C = Year(Now)
D = A & "-" & B & "-" & C
E = ActiveSheet.Name
G = 2 'First Paste Row
    Sheets.Add
    ActiveSheet.Name = D
    Range("A1") = "Date"
    Range("B1") = "Time"
    Range("C1") = "Name"
    Range("D1") = "Details"
Worksheets(E).Activate
F = 2 'Starting row. Change this if necessary.
H = 1 'Column containing dates (A=1, B=2 etc) Change this if
necessary.
Do Until Cells(F, H) = ""
If Cells(F, H).Value = Date Then
    Range("A2:D2").Copy
    Worksheets(D).Activate
    Cells(G, 1).Select
    ActiveSheet.Paste
    Selection.EntireColumn.AutoFit
    Application.CutCopyMode = False
G = G + 1
End If
F = F + 1
Worksheets(E).Activate
Loop
Worksheets(D).Activate
End Sub
0
3/13/2008 5:34:28 PM
Many Thanks Dave

I'm Halfway there

It Created the new sheet perfectly, but I couldn't get it to copy th
data over, I even tried creating a new sheet with the sample data a
posted here, with the date in column A and changed the dates t
todays.

Many Thanks




'Dave[_6_ Wrote:
> ;639151']Hi Pat,
> The following code should do what you want. It creates a new sheet,
> names it with today's date, and then fills in the right info.
> Just copy and paste it into a VBA module.
> The macro assumes the following:
> That you will run the macro when the sheet containing your info, is
> active.
> That the dates to be searched are in column A, starting in row 2.
> See comment in code to change this if necessary.
> It's untidy, and jumps around while it's working, but it's all I have
> time for.
> If you want to do this more than once in a day, you have to delete the
> new sheet first.
> Regards - Dave.
> 
> Sub DoWhatPatWants()
> A = Day(Now)
> B = Month(Now)
> C = Year(Now)
> D = A & "-" & B & "-" & C
> E = ActiveSheet.Name
> G = 2 'First Paste Row
> Sheets.Add
> ActiveSheet.Name = D
> Range("A1") = "Date"
> Range("B1") = "Time"
> Range("C1") = "Name"
> Range("D1") = "Details"
> Worksheets(E).Activate
> F = 2 'Starting row. Change this if necessary.
> H = 1 'Column containing dates (A=1, B=2 etc) Change this if
> necessary.
> Do Until Cells(F, H) = ""
> If Cells(F, H).Value = Date Then
> Range("A2:D2").Copy
> Worksheets(D).Activate
> Cells(G, 1).Select
> ActiveSheet.Paste
> Selection.EntireColumn.AutoFit
> Application.CutCopyMode = False
> G = G + 1
> End If
> F = F + 1
> Worksheets(E).Activate
> Loop
> Worksheets(D).Activate
> End Su


--
Pat-UK
0
3/14/2008 11:15:14 AM
Hi Pat,
Did you get an error message when you ran the macro?

I noticed when I checked the posting, that the format of this forum
has wrapped one of the code lines because it was too long.
The following code line should be on only one line in your VBA macro,
not wrapped onto a second line as it appears here:

H = 1 'Column containing dates (A=1, B=2 etc) Change this if
necessary.

Not sure if this will solve the problem. Let me know.
Regards - Dave.
0
3/14/2008 8:21:37 PM
Yes I did notice this and corrected it when I first tried it, so it's
not that.

Thanks Once again for checking.

Pat

'Dave[_6_ Wrote: 
> ;639775']Hi Pat,
> Did you get an error message when you ran the macro?
> 
> I noticed when I checked the posting, that the format of this forum
> has wrapped one of the code lines because it was too long.
> The following code line should be on only one line in your VBA macro,
> not wrapped onto a second line as it appears he
> 
> H = 1 'Column containing dates (A=1, B=2 etc) Change this if
> necessary.
> 
> Not sure if this will solve the problem. Let me know.
> Regards - Dave.




-- 
Pat-UK
0
3/15/2008 8:46:39 AM
OK I think I know why it's not working.

The Sheet it set as a database sheet so the columns have names, the
date one is called Call_Date, will this make a difference to the
required code ??

Many Thanks




-- 
Pat-UK
0
3/16/2008 2:23:15 PM
WOO HOO,

I did it, I had a play with advance filter and after quite a few dat
issues i worked out how to get it to work, 

I was using =now() in the form to put the date in the Database shee
and then formatting the cell in the database sheet to show date only
What I should have done was used =Int(now)) in the form, 

Once I worked out that part was giving me the problems, advanced filte
using dates turned out to be not as problematic as I first thought.

Thanks again everyone


--
Pat-UK
0
3/17/2008 12:02:16 PM
Reply:

Similar Artilces:

Sorting
Hi, is it possible to use variable for sorting? Something like: declare @sort varchar(10) SET @sort='column1 DESC' SELECT ROW_NUMBER() OVER (ORDER BY @sort)AS rowId, * FROM table Is dynamic SQL only option? Thank you, Simon On 15/04/2010 11:28, simon wrote: > Hi, > > is it possible to use variable for sorting? > > Something like: > > declare @sort varchar(10) > SET @sort='column1 DESC' > > SELECT ROW_NUMBER() OVER (ORDER BY @sort)AS rowId, * FROM table > > Is dynamic SQL only option? You can use CASE to he...

How to sort account list?
I'm using MS Money 2004 Small Business. In the account list, my accounts are catagorized by and in this order: - bank accounts - credit accounts - investment accounts - loans and liabilities - asset accounts TOTAL BALANCE In the above view, I cannot easily determine totals for assets and liabilities. The following view does this. - bank accounts - investment accounts - asset accounts SUBTOTAL -loans and liabilities SUBTOTAL TOTAL BALANCE How do I get the above view? Thanks, Brett I don't use Small Business. But you can run a Net Worth report to get total assets and ...

How to Merge Date from 3 columns to 1
I have a spreadsheet where the date is spread over 3 columns I,J & K and I wish to merge them to Column B in the format dd-mmm-yyyy as shown below. B I J K 02-Feb-2003 02 Feb 2003 27-Mar-1999 27 Mar 1999 01-Apr-1978 Apr 1978 01-Jan-1998 1998 14-Jun-2002 14 Jun 2002 Where there is a blank for the day in 'Column I' I need it to copy as 01 and where there is a blank for the month in 'Column J' I need it to copy as Jan. Where all 3 column...

Where's the Sort by New Message option?
Not sure when the layout of the newsgroups changed but I can't seem to find the ability to sort by new message in a thread instead of sorting by just the original thread date. That was hugely helpful as I could follow along and see what threads were still active. If you're gonna hang around in the newsgroups (any newsgroups), you may want to start using a newsreader. Microsoft Outlook Express can do it for you. Saved from a previous post: You may want to connect to the ms newsserver directly: If you have Outlook Express installed, try clicking on these links (or copy and paste i...

Row names will not move with sort
Each row in my summary table in Sheet1 is hyperlinked to a corresponding table in Sheet2 with additional details. I need to move the rows in my summary table (Sheet1) and preserve the links to and from the details tables (Sheet2). I found that I can move rows in Sheet1 with cut & insert and the hyperlinks are maintained. I can travel from a row in summary table (Sheet1) to details table (Sheet2) and back, even after the corresponding row (Sheet1) was moved. But if I sort the rows in Sheet1 the links from Sheet2 back to corresponding rows in Sheet1 lead to presorted locations. Apparen...

Microsoft Query criteria syntax for date() or today()
Essentially, I need MS Query syntax for a calculation based on today's date. I'm using Microsoft Query from inside Excel to extract data from an ODBC database. I want to download everything with a date of, say, in the last 60 days. I can't find any documentation for Microsoft Query and its Help doesn't seem to address this. I've tried Excel and Access systax such as >Date()- 60 and =Today()-60. I've tried copying in the SQL text created by Access. I don't know how to say "Today" or "Now" or "Date". Any help out there? ...

formula to update todays date in excell automatically daily
formula to update todays date in excell automatically daily =NOW() or =TODAY() -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Vishal" <Vishal@discussions.microsoft.com> wrote in message news:1065C8D9-220E-4071-AEEC-B3ECE6593D1D@microsoft.com... > formula to update todays date in excell automatically daily ...

sorts not sorting
OK- Thanks to everyones help I now i have a list i can work with... but there are a few problems.... the zips are all 5 digit and now i have to sort them... the problem is, THEY WONT SORT CORRECTLY!!!!!!! The numbers are not in order... some are but a lot are not... is there anyway to fix this???? i need to sort them by zip code but cant seem to get them to do it correctly.. any ideas??? ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ You are going to be far better of...

Can't move message to another folder
Using Outlook 2002 and cannot send/receive email nor can I move a message from inbox to another folder. No error, no explanation. Worked fine yesterday. Windows XP PRO with Office XP SBE. Anybody have this happen to them before? TIA! You should at least get some sort of message when you send yourself an e-mail and do a manual Send/Receive (either you get an error message or your own message) For the moving; how do you move them? Clear your Deleted Items folder and run scanpst.exe against your pst-file (when Outlook is closed) and try again. -- Roady [MVP] www.sparnaaij.net Micro...

Highlight date nearest to TODAY()
Hi I have dates in a column in this format : 16/01/2010 16/02/2010 16/03/2010 16/04/2010 16/05/2010 16/06/2010 I'm trying to set the conditional formatting so that the nearest date to today is in bold. Can someone help with this? Grateful for any advice. Best Wishes Define nearest. If these were your dates: 15/3/2010 17/3/2010 And today was 16/3/2010 Which is the nearest date? -- Biff Microsoft Excel MVP "Colin Hayes" <Colin@chayes.demon.co.uk> wrote in message news:iw0DNgAaMDoLFwgB@chayes.demon.co.uk... >...

import- number- sort?
I imported this data into a spread sheet- I tried to format it to number, but when I sort it- I get : 37.08 4.33 4.79 4.8 42.56 5.94 Whats up with this? Thanks Brent Hi Brent, Install the TrimAll macro, select the column and invoke the macro from Alt+F8 http://www.mvps.org/dmcritchie/excel/join.htm#trimall Directions to install and use a macro at http://www.mvps.org/dmcritchie/excel/getstarted.htm#havemacro I expect that you have spaces or CHAR(128) "Required Blank" characters in you data you can check is =LEN(A1) --- HTH, David...

2 copies coming into Inbox
I recently paid for a hotmail account so I could have larger storage and not get cancelled for any reasons such as not checking it often enough. I followed the instructions and put my service on Outlook Express. Now I'm receiving 2 of every message. What's up? Can I fix this? Thanks Darla ...

macro in excel to copy from excel to word
i have a database in excel...which i would like to take more advantag of. I also have some forms in Word that I was hoping to be able to get the to be automatically completed using the excel database. Initially thought this would be quite simple.... just record the macr then modify it to suit. This using simple copy from excel and paste into word document, o pasting into form..field..values. I have done a little before with excel macros - to a level of 'usin excel programming for dummies' book. But really do not know where t start now. Have seen this: "Dim appWD As Word.Appl...

date formula #2
Hi i am trying for a way to work out how i can formulate the date, ie. if today is 17 November 2003, i want to import data from date 1 Novemeber 2003 how would i do this and what formulae would i use? any idea ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com =today()-1 GB "jaggosai" <jaggosai.x32sz@excelforum-nospam.com> wrote in message news:jaggosai.x32sz@excelforum-nospam.com... > > Hi i am trying for a way to work out how i can formulate the dat...

sorting macro #3
I need to sort on 8 cells in a row and on 1500+rows. I can do it one at a time but I know there must be an easier way. Can ANYONE HELP? C3:J3 I need these cells sorted and then down to C1532:J1532 I did create a macro to sort after I selected them but still one at a time. Does it have to be a macro? I can edit a macro but don't really know how to program them. Yes, it has to be a macro. The following should do it. This macro loops through all the entries in Column C, and in each row it sorts the values in Columns C:J. HTH Otto Sub SortRows() Dim rColC As Range Dim i As...

date formatting a cell
When I use the date formatting in a cell i.e. m/d/yy and enter my numbers i.e 2604, I get 2/16/07. Can you help me Hi you have to enter the date with delimiters. so you have to enter 2/6/04 If you want Excel to automatic convert numbers you have to use VBA. Have a look at http://www.cpearson.com/excel/DateTimeEntry.htm for an example event procedure Frank vos wrote: > When I use the date formatting in a cell i.e. m/d/yy and enter my > numbers i.e 2604, I get 2/16/07. Can you help me Hi that is the way Excel handles date inputs. As Excel stores dates internally as numbers it does ...

Excel date problems
Our company uses a report writer/formatter that creates Excel spreadsheets and then sends them as email attachments to specified users. The data being formatted is coming from a file shipped to the report software from an I5 environment. The data coming in is in the format mmddyyyy but some of the cells in the SS are being converted to ddmmyyyy. When this problem occurs it only happens for months 10, 11, and 12. These dates are being used in calculations so this is a big problem. We are using Excel 2003. Any ideas? ...

Can we sort a form and also be able to enter new records.
Hi, It is possible to sort the data on a form and also be able to enter new and edit the existing records in it. Cheers! On Tue, 15 Jan 2008 15:41:16 -0800 (PST), Rex wrote: > Hi, > > It is possible to sort the data on a form and also be able to enter > new and edit the existing records in it. > > Cheers! I assume you mean "Is it". The form sort order has nothing to do with editing or adding new records, so the answer is yes. If you cannot edit or add new records, make sure the form's record source, if it is a query, is updateable. Some queries are not. O...

Auto-entering data from another sheet
Hello all, Hopefully someone can help me. I am wanting to automatically enter data from one sheet into the next by a text prompt. For example: On sheet 2 I will have 3 static columns that will have data entered in the format: text / text / number respectively. On sheet one I want to be able to enter the text from the first column on sheet two and have excel automatically fill in 2 other cells with the data from cell B and C from sheet 2. For example: Sheet 2 contains hello / how / 123 in row 1 and column A,B,C. I enter: hello (on sheet 1 cell A) and in cell B and C I automatically get...

sum if and between dates
Hi all I am trying to sum information based on the following conditions Cell E3 = Sum if = *Account A* and between *>= 20/6/05 and <=24/6/05* The Answer would be 279 A B C D E 1 19/06/2005 Account A 125 20/06/2005 2 20/06/2005 Account A 150 24/06/2005 3 21/06/2005 Account B 156 Account A 4 22/06/2005 Account B 135 5 23/06/2005 Account C 142 6 24/06/2005 Account A 129 7 25/06/2005 Account C 200 8 26/06/2005 Account A 300 -- mathewheys ---------------------------------------------------...

Sorting checking register
How do i sort my check register in Money 2004 Deluxe so that uncleared transactions appear below cleared transactions? In Quicken i could click on the column to provide that sort. In microsoft.public.money, Dean wrote: >How do i sort my check register in Money 2004 Deluxe so >that uncleared transactions appear below cleared >transactions? In Quicken i could click on the column to >provide that sort. You don't. Available choices are chosen by clicking View at the top of the register. ...

Is there a template for creating math practice sheets for add, su.
I want to create a practice sheet for specific tables (like 7's, 9's), and be able to get new problems and have answers. ...

Compressing Data in Sheet
Hi, I have a sheet with several pieces of data arranged like so: Column 1 Column 2 a.dll ! 0x000001234 56 a.dll ! 0x000001234 64 a.dll ! 0x000001234 72 b.dll ! 0x012345689 89 c.dll ! 0x012345890 100 How do I compress the repeated sets of say a.dll into one row with all values pertaining to a.dll in column 2 summed up so to read something like: a.dll ! 0x0000001234 182 b.dll ! 0x012345689 89 etc ??? Thanks If the data is sorted by column A, you could add headers (in row 1) and then use Data|subtotals...

Activate all sheets
Hi I need help with the following macro: I am grouping all the worksheets together, and selecting the row, above which I wish to insert a new row. I want to insert a new row on all sheets, the enclosed macro at the moment is only inserting a new row on the first sheet. Selection.EntireRow.Insert Range("AD5:AE5").Select Selection.AutoFill Destination:=Range("AD5:AE594"), Type:=xlFillDefault Range("AD5:AE594").Select ActiveWindow.ScrollRow = 5 Range("D5").Select Can anyone help me with this? George Gee Sheets(Array("...

using addrress books to sort incoming mail
I use address books to sort incoming mail. An odd thing: depending on how the sender's name comes across, it doesn't get caught by the filter (amd moved to the "Family Mail" Folder I have set up. for example: my mom and dad's email (from momanddad@somedomain.com) comes as from that address. However, in my contacts, they are listed by their names: John and Mary Smith, with momanddad@somedomain.com as their email address and John and Mary Smith as the display name. What have I done wrong? TIA 1. The big ONE - failed to post your version of Outlook. Rules operate at ...