Click here to Skip to main content
15,890,690 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How do i Copy/Paste all new rows from all worksheets to new Worksheet where the date is =>28/03/2014?
Posted
Comments
karthik Udhayakumar 28-Apr-14 22:59pm    
From all worksheet means?
Member 10781847 29-Apr-14 6:01am    
Yes from all

1 solution

You can use ADO.Recordset[^] and Range.CopyFromRecordset[^] method.

Here[^] you'll find the proper connection string to MS Excel file.

The command would looks like this:
SQL
SELECT *
FROM (
    SELECT Field1, Field2, ... FieldN
    FROM [Sheet1$]
    UNION ALL
    SELECT Field1, Field2, ... FieldN
    FROM [Sheet2$]
    UNION ALL
    SELECT Field1, Field2, ... FieldN
    FROM [Sheet3$]
) 
WHERE DateField =>#2014/03/28#


Note: Do not forget about MS Excel limitations[^]. You need to restrict the count of records to the count of rows in a worksheet.
 
Share this answer
 
Comments
Member 10781847 2-May-14 19:00pm    
I have figured the solution but some people here they tried to take the credit for themselves.
Maciej Los 3-May-14 4:07am    
And... Where is your answer (solution)?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900