Harvin weber
Harvin weber

Reputation: 1

Macro to copy range based on date and multiple criteria to another file

I am not much aware of VBA coding, i am having to do some manual effort, would really appreciate if you could help with this, I tried searching through but could not find any suitable answers. I would like to copy rows based on couple of conditions.

My data is in ‘Workbook A’ in sheet1, Col A to Col X, Col C has dates and Col W has the list of employee names. In ‘Workbook B’, i have the criteria in sheet 1 , cell A1 contains a date (which i would input) and there are around 20 employee names in Col B from B1 to B20 What i am looking at is The rows from A to X in ‘Workbook A’ should be copied based on criteria in ‘Workbook B’ which is date present in cell A1 and IF Col W (in workbook A)contains any of the employee names in B1 to B20 to Workbook B,Sheet 2 (the code/macro would be in Workbook B) rows are being copied from one workbook to another Thank you in advance

Upvotes: 0

Views: 537

Answers (1)

Tim Nevins
Tim Nevins

Reputation: 341

You can do this with Advanced Filter. In fact, this is a perfect use for it. On the Data ribbon/tab, click Advanced in the Sort & Filter area. Select the data source, the criteria where you want the results (click "Copy to another location").

The criteria and your copy location must have the same column headings as on your data table, i.e. if your data table tops the date field with "MyDate", the criteria must have the exact same heading (watch for spaces!).

Google Excel Advanced Filter. There are a couple of pages with all the information you could ever want on Advanced filter. Far too much information to recount here.

Upvotes: 0

Related Questions