A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to pull only dates within a requested dynamic range



 
 
Thread Tools Display Modes
  #1  
Old April 17th, 2010, 05:46 PM posted to microsoft.public.excel.misc
Roady
external usenet poster
 
Posts: 73
Default How to pull only dates within a requested dynamic range

Hello:
I have two tabs in a workbook. The 1st tab will be the user interface. The
2nd tab will be the database of information. Both tabs are set up with
identical column headers.

In the 1st tab, the user will select a start and end date (for a date range)
and also a department. I want to create a macro or something whereby it will
pull only lines of data that relate to dates that fall within that date range
and also department.

For example, the user selects 4/18/10-4/21/10 and dept 66 on tab 1. If on
the 2nd data source tab, there is an item listed in dept 66 with a date range
of 4/21/10-4/22/10, I would like it to still capture and pull the information
into the 1st tab. Although the ranges don't match up exactly, the important
thing is that there is some crossover between the date ranges so it should be
included in the data pull.

How do I get it to pull the full line of applicable data from the 2nd tab
into the 1st tab?

Thank you! Roady
  #2  
Old April 17th, 2010, 07:54 PM posted to microsoft.public.excel.misc
Don Guillett[_2_]
external usenet poster
 
Posts: 607
Default How to pull only dates within a requested dynamic range

Why not just use ONE sheet and use datafilterautofilter
If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Roady" wrote in message
...
Hello:
I have two tabs in a workbook. The 1st tab will be the user interface. The
2nd tab will be the database of information. Both tabs are set up with
identical column headers.

In the 1st tab, the user will select a start and end date (for a date
range)
and also a department. I want to create a macro or something whereby it
will
pull only lines of data that relate to dates that fall within that date
range
and also department.

For example, the user selects 4/18/10-4/21/10 and dept 66 on tab 1. If on
the 2nd data source tab, there is an item listed in dept 66 with a date
range
of 4/21/10-4/22/10, I would like it to still capture and pull the
information
into the 1st tab. Although the ranges don't match up exactly, the
important
thing is that there is some crossover between the date ranges so it should
be
included in the data pull.

How do I get it to pull the full line of applicable data from the 2nd tab
into the 1st tab?

Thank you! Roady


  #3  
Old May 17th, 2010, 06:40 PM posted to microsoft.public.excel.misc
Roady
external usenet poster
 
Posts: 73
Default How to pull only dates within a requested dynamic range

Ok, I won't get into the details as to why I wanted to use multiple
sheets...But even if I use one sheet, I will have one column that says "Start
Date" and one column that says "End Date". I need the user to be able to say
that they need to pull any activities that occur including and BETWEEN those
dates. So if the user needs all activities that happen between May 1 and May
10, and a particular activity happens between May 3 and May 6, it would still
show up - does that help?

"Don Guillett" wrote:

Why not just use ONE sheet and use datafilterautofilter
If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Roady" wrote in message
...
Hello:
I have two tabs in a workbook. The 1st tab will be the user interface. The
2nd tab will be the database of information. Both tabs are set up with
identical column headers.

In the 1st tab, the user will select a start and end date (for a date
range)
and also a department. I want to create a macro or something whereby it
will
pull only lines of data that relate to dates that fall within that date
range
and also department.

For example, the user selects 4/18/10-4/21/10 and dept 66 on tab 1. If on
the 2nd data source tab, there is an item listed in dept 66 with a date
range
of 4/21/10-4/22/10, I would like it to still capture and pull the
information
into the 1st tab. Although the ranges don't match up exactly, the
important
thing is that there is some crossover between the date ranges so it should
be
included in the data pull.

How do I get it to pull the full line of applicable data from the 2nd tab
into the 1st tab?

Thank you! Roady


.

  #4  
Old May 17th, 2010, 07:02 PM posted to microsoft.public.excel.misc
Luke M[_4_]
external usenet poster
 
Posts: 451
Default How to pull only dates within a requested dynamic range

Psuedocode...will need some modification to suit:

Sub CopyData

StartDate = Range("B2")
EndDate = Range("C2")
xDept = Range("D2")

'Clear old data
Range("A2:Z1000").ClearContents

'Starting row for imported data
i = 4
'Look through the department column
For each c in Worksheets("Other sheet").Range("A2:A100")
'Assumes date is in the column to the right of department
if c = xDept and c.offset(0,1) = StartDate and c.offset(0,1) =EndDate
then
c.EntireRow.Copy Cells(i,1)
i= i+1
end if
next c
--
Best Regards,

Luke M
"Roady" wrote in message
...
Ok, I won't get into the details as to why I wanted to use multiple
sheets...But even if I use one sheet, I will have one column that says
"Start
Date" and one column that says "End Date". I need the user to be able to
say
that they need to pull any activities that occur including and BETWEEN
those
dates. So if the user needs all activities that happen between May 1 and
May
10, and a particular activity happens between May 3 and May 6, it would
still
show up - does that help?

"Don Guillett" wrote:

Why not just use ONE sheet and use datafilterautofilter
If desired, send your file to my address below. I will only look
if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Roady" wrote in message
...
Hello:
I have two tabs in a workbook. The 1st tab will be the user interface.
The
2nd tab will be the database of information. Both tabs are set up with
identical column headers.

In the 1st tab, the user will select a start and end date (for a date
range)
and also a department. I want to create a macro or something whereby it
will
pull only lines of data that relate to dates that fall within that date
range
and also department.

For example, the user selects 4/18/10-4/21/10 and dept 66 on tab 1. If
on
the 2nd data source tab, there is an item listed in dept 66 with a date
range
of 4/21/10-4/22/10, I would like it to still capture and pull the
information
into the 1st tab. Although the ranges don't match up exactly, the
important
thing is that there is some crossover between the date ranges so it
should
be
included in the data pull.

How do I get it to pull the full line of applicable data from the 2nd
tab
into the 1st tab?

Thank you! Roady


.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:11 AM.


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