Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching for date in future (Excel)

Status
Not open for further replies.

2ks

Technical User
Jan 13, 2007
54
GB
I am writing a Excel database and one of the functions will include the automated searching of appts that the date = tomorrows date, which will obviously be diff each day

The column that the date of appt is in date format.

Can any one advise me on the VBA for this function.

Thanks
 
tomorrows date is simply Date + 1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Tried suggestion and does not show the line as required

Attached code below

Sub newdate()
'
' newdate Macro
' Macro recorded 13/01/2007 by Home
'

'
Selection.AutoFilter Field:=21, Criteria1:=Date + 1
End Sub
 
What is the code generated by the macro recorder when you do the filtering manually ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
When I generate the code manually I only know who to select a specific date and that works fine.

problem is, as I will need to run the macro daily the selection date will change daily, so a fixed date filter is not possible.

Also the spreadsheet will grow and grow so it needs to look at the whole column
 
Again, what is the code generated when you select a specific date ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I see

this is what the manual macro has produced but after running it goes onto the first blank line, hiding any lines of data that may have been selected.

Sub tom_date()
'
' tom_date Macro
' Macro recorded 13/01/2007 by Home
'

'

Selection.AutoFilter Field:=21, Criteria1:="14/01/07"
End Sub

Your help is very appreciated. I feel a total pleb not being able to work this out
 
after running it goes onto the first blank line
You don't have data matching the filter ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for your help

All it was I was using date format dd/mm/yy instead of dd/mm/yyyy and as soon as corrected. Bingo

Many thanks for your help

Til the next time

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top