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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find data meeting criteria, copy and paste then find the next

Status
Not open for further replies.

smalty

Technical User
Jan 9, 2005
74
GB
I have 2 worksheets. On one there is data
Date Category Cash/Chq Amount

I want to be able to find data that matches a date range and if it is 'Cash', if data is found, copy the row then paste it into worksheet 2 at lets say cell A1, then go off and find the next data that meets the criteria, copy that and paste it in worksheet 2 but in cell A2 and continue to do this until no more data can be found
 



Hi,

Why not use a PivotTable? Easy peasy!

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks for that suggestion Skip and of course I can achieve the desired result using a pivot table and short of anything else I will have to use it but I was hoping to do this a little more automated as currently I would have to filter the data first in worksheet 1 (as far as I know yu cannot specify a date range in a pivot table) then use the filtered data to construct the pivot table and this would have to be done for each set of different criteria which is not that much of a heartache for maybe 1 or 2 sets of criteria but if 1 or 2 jumps to 10 to 15 it becomes a little tedious.
 


If it were me, I'd use MS Query (Data > Import External Data...) and VBA to specify the date range in the SQL criteria.

However another method might be to use the AutoFilter in the Source data to filter the date and 'Cash' column, COPY the visible cells and Edit > PasteSpecial -- VALUES in the tagert sheet. Turn on your macro recorder to record that process and post back your recorded code, if that method works for you, to get help customizing the code.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks again Skip......I blame my age for always forgetting about the Query. Solved

Regards
Smalty
 


I blame my age for always forgetting about the Query.
How about 68 years, 10 months, 28 days?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
OK I come a fairly close second.......nearly 61. Appreciate the help anyway.

Thanks again

Happy New Year
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top