need to split month out from date formatted cell

J

John R.

Hi, I have a workbook that is used throughout the company.
My boss wants to report on certain fields based on month.
The only problem is that all cells with a date in them are
all mm/dd/yy. I want to present my boss with a userform
that will ask her what month she wants, then go to any
worksheet and get the information she needs.

How can I query the date cells with only a 2 digit month?

Thanks
 
J

John

Hi again, but the current content of the cell is say
11/21/03, and the next cell in the column is 11/25/03, the
next cell might be 07/30/02. How do I only get rows in
which the month is 11? Sorry I'm new to VB and don't quite
understand the code you have written.
 
J

John

I guess I should also tell you that I'm storing the month
she picks into x1 of my worksheet, I then have to query a
closed workbook to get the information for the month she
has picked.

I'm also using Excel 97 on a Win2k machine.
 
J

Joe Bloggs

John

You might find that an advanced filter is what you need.
See Deborah Dalgliesh's site Contextures.com

The criterion to filter November's data would be
=MONTH(A11)=11 if the dates are in column 1 and the list
starts at row 11.

You can use an inputBox for the manager to to insert the
month number with somthing like

x = Inputbox("Enter the number of the month")
range("a2")= "=MONTH(A11)=x"

Deborah shows how to extract certain fields to another
place

Peter Atherton
 

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