0

I have two workbooks. Once contains dynamic data which is updated on a weekly basis (dynamic pivot table). The other contains a master sheet within which this data needs to be inputted.

Within VBA, how can i copy and paste the data based on a match on the headers? The two tables have the same headers (being dates). Sheet one has headers located starting from cell G6 and this increases on a weekly basis as new dates added.

i would like to write a macro which will copy and paste the data from one workbook to another if the two headers match.

Kind regards

D

Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
Drij Vyas
  • 17
  • 5

1 Answers1

0

Here you can find how to copy from one workbook to another : excel Campus

Then all you have to do is to check if some columns match and get the cells range you want to copy.

Here you can find some informations about column names and some actions with them : Stackoverflow/ Get column name

Hope it helps.

Best regards.

VirussInside
  • 187
  • 17
  • will Try and clarify my issue I have two workbooks, one being WB1 and another being WB2. in WB1 i have multiple pivot tables. These are refreshed on a weekly basis. they often (not always) gain a new column with a new date. I would like the data generated via one pivot table to be dynamically linked to another workbook. However, i only want the data to be copied into WB2 from WB1 ONLY IF the two workbooks have the same columns. If the columns are not same/some of the columns are missing, i would like a value of 0 to be inserted here. What is the best way of doing this? Thanks D – Drij Vyas Sep 10 '19 at 16:56