Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Query on month and day in code?

Hello,

My boss has asked that I create a data entry form for the data entry clerks
to key in a date on my userform. If the customer does not provide us a year
for the birthdate, then we just key in the month and day.

I am using the calendar control. My boss had me set the default year to 1900.

I am using code to query for other fields which work well.

wks.Range("A1:n" & wks.Range("a1").End(xlDown).Row).AdvancedFilter
Action:=xlFilterCopy, CriteriaRange:=wks.Range( _
"t1:an2"), CopyToRange:=wks.Range("ah1:au10000"), Unique:=True

Now if I try to to put in mm/dd in the criteria range cells (z2"), I don't
get anything. Excel automically tries to query for mm/dd/2009.

If I convert mm/dd into a string with 'mm/dd, I still don't get anything.

Can anyone help me understand how to query by mm/dd? If the data reads,

name birthday
Dave 7/1/1900
Mary 7/1/2009
Joe 6/2/2009

If I query for 07/01, I'd like to get the first two rows.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Query on month and day in code?

I did some search and playing with the code. I found:

1) Input the dates as strings from the calendar control
2) In the criteria cell (z2), enter ="08/17*"

This pulls up just month and day regardless of the year. Works perfect.



"Webtechie" wrote:

Hello,

My boss has asked that I create a data entry form for the data entry clerks
to key in a date on my userform. If the customer does not provide us a year
for the birthdate, then we just key in the month and day.

I am using the calendar control. My boss had me set the default year to 1900.

I am using code to query for other fields which work well.

wks.Range("A1:n" & wks.Range("a1").End(xlDown).Row).AdvancedFilter
Action:=xlFilterCopy, CriteriaRange:=wks.Range( _
"t1:an2"), CopyToRange:=wks.Range("ah1:au10000"), Unique:=True

Now if I try to to put in mm/dd in the criteria range cells (z2"), I don't
get anything. Excel automically tries to query for mm/dd/2009.

If I convert mm/dd into a string with 'mm/dd, I still don't get anything.

Can anyone help me understand how to query by mm/dd? If the data reads,

name birthday
Dave 7/1/1900
Mary 7/1/2009
Joe 6/2/2009

If I query for 07/01, I'd like to get the first two rows.

Thanks.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot Table + Microsoft Query + Current Month THE_RAMONES Excel Worksheet Functions 1 November 11th 08 04:52 PM
Hard code month in Excel Rachel Costanza Excel Discussion (Misc queries) 6 November 7th 08 02:04 AM
Current Month Query Sunshinegm Excel Worksheet Functions 1 February 15th 05 01:41 AM
VBA Code for Multiple Month Spreadsheet Gary T Excel Programming 0 December 22nd 04 11:13 AM
MS Query - STANDARD DATE to YEAR-MONTH papegoja Excel Programming 1 October 14th 03 07:20 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"