Macro filter based on date criteria

P

puiuluipui

Hi, i need a macro that can filter range A8:G200 based on criteria in G column.
Criteria is date, and i need to filter based on today's date. If today is
19.09.2009, then the macro to filter range and to show only rows with
19.09.2009 in G column.
Cand this be done?
Thanks!
 
T

trip_to_tokyo

Yes it can but I don't think that you need a macro to do it.

I have just set up your example and got it to work no problem.

In Excel 2007 take the following actions:-

1. Click anywhere in your data then:-

Data / Filter

This will turn on drop down arrows (at top of data).

2. Click on the downwards facing arrow in column G and select Data Filters
then Today.

The above will give you what you want.

Please click on Yes if my comments have been helpful to you.

Thanks!
 
P

puiuluipui

Hi, the problem is that i have Excel 2003. If i can do in Excel 2003 like you
show me before with 2007, it will be great.
But this is what i need. I need to filter this range based on criteria in G
column. Criteria to be today, so to view only rows with today's date in G
column. After i filter range, i need to copy filtered rows to another
workbook. That's why i need an macro to filter. To adjust the macro to
copy/paste i will do it with record, but the filter range is a little bit
different.
Can this be done?
Thanks!
 
F

Fred Smith

You can record the whole macro. Turn on the macro recorder before you start
filtering your data. Turn it off after you finish your copying.

You will likely have to adjust your macro slightly, and that's where this
board can help. But to create the whole procedure, you're better off
recording the macro yourself than asking someone else to create it for you.
In order for someone else to create the code for you, they would have to
know whether your cells have real dates in them, or are text. If text, then
what format. The macro recorder is a much faster solution.

Regards,
Fred.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top