I need help to consolidate some massive data files. i will be really greatful to anyone who can give me a working VBA code. have spent almost 2 days trying, powerqueries,match etc etc. i am now convinced a well written VBA code is my only way out.. please help..
Here is the different datasets
Dataset A (in a separate worksheet sheet1)
[TABLE="class: grid, width: 295"]
<colgroup><col><col><col span="2"></colgroup><tbody>[TR]
[TD]ID
[/TD]
[TD="align: center"]Date
[/TD]
[TD="align: center"]title
[/TD]
[TD="align: center"]Qty
[/TD]
[/TR]
[TR]
[TD]abc123abc[/TD]
[TD="align: right"]18/12/2013
[/TD]
[TD="align: center"]Things [/TD]
[TD="align: right"]492[/TD]
[/TR]
[TR]
[TD]xyz12xy[/TD]
[TD="align: right"]14/9/2014[/TD]
[TD="align: center"]Fame [/TD]
[TD="align: right"]485
[/TD]
[/TR]
[TR]
[TD]qpqpqpqp[/TD]
[TD="align: right"]29/5/2014[/TD]
[TD="align: center"]Door [/TD]
[TD="align: right"]3724[/TD]
[/TR]
</tbody>[/TABLE]
DataSetB1 (each in a separate worksheet named on the value in column B1 i.e. 20131216 in this example)
[TABLE="class: grid, width: 536"]
<colgroup><col><col span="7"></colgroup><tbody>[TR]
[TD]ID
[/TD]
[TD="align: right"]20131216
[/TD]
[TD="align: right"] 20131217
[/TD]
[TD="align: right"]20131218
[/TD]
[TD="align: right"]20131219
[/TD]
[TD="align: right"]20131220[/TD]
[TD="align: right"] 20131221
[/TD]
[TD="align: right"]20131222[/TD]
[/TR]
[TR]
[TD]abc123abc[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]9[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]xyz12xy[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]32[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]1
[/TD]
[/TR]
</tbody>[/TABLE]
DataSetB2 (each in a separate worksheet named on the value in column B1 i.e. 20131223 in this example)
[TABLE="class: grid, width: 512"]
<colgroup><col span="8"></colgroup><tbody>[TR]
[TD]ID
[/TD]
[TD="align: right"]20131223[/TD]
[TD="align: right"] 20131224
[/TD]
[TD="align: right"] 20131225
[/TD]
[TD="align: right"]20131226[/TD]
[TD="align: right"] 20131227
[/TD]
[TD="align: right"] 20131228
[/TD]
[TD="align: right"] 20131229
[/TD]
[/TR]
[TR]
[TD]xyz12xy[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]52[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]9[/TD]
[/TR]
[TR]
[TD="colspan: 2"]qpqpqpqp[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1
[/TD]
[/TR]
</tbody>[/TABLE]
The desired output is a consolidation of all datasetB type worksheets (about 75) with the 1 databaseA worksheet.
Sample output set required
[TABLE="class: grid, width: 1163"]
<colgroup><col><col><col span="16"></colgroup><tbody>[TR]
[TD]ID
[/TD]
[TD]Date
[/TD]
[TD]title[/TD]
[TD]Qty[/TD]
[TD="align: right"]20131216[/TD]
[TD="align: right"]20131217[/TD]
[TD="align: right"]20131218[/TD]
[TD="align: right"]20131219[/TD]
[TD="align: right"]20131220[/TD]
[TD="align: right"]20131221[/TD]
[TD="align: right"]20131222[/TD]
[TD="align: right"]20131223[/TD]
[TD="align: right"]20131224[/TD]
[TD="align: right"]20131225[/TD]
[TD="align: right"]20131226[/TD]
[TD="align: right"]20131227[/TD]
[TD="align: right"]20131228[/TD]
[TD="align: right"]20131229[/TD]
[/TR]
[TR]
[TD]abc123abc[/TD]
[TD="align: right"]18/12/2013[/TD]
[TD]Things [/TD]
[TD="align: right"]492[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]9[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]xyz12xy[/TD]
[TD="align: right"]14/9/2014[/TD]
[TD]Fame [/TD]
[TD="align: right"]485[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]32[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]52[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]9[/TD]
[/TR]
[TR]
[TD]qpqpqpqp[/TD]
[TD="align: right"]29/5/2014[/TD]
[TD]Door [/TD]
[TD="align: right"]3724[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[/TR]
</tbody>[/TABLE]
Here is the different datasets
Dataset A (in a separate worksheet sheet1)
[TABLE="class: grid, width: 295"]
<colgroup><col><col><col span="2"></colgroup><tbody>[TR]
[TD]ID
[/TD]
[TD="align: center"]Date
[/TD]
[TD="align: center"]title
[/TD]
[TD="align: center"]Qty
[/TD]
[/TR]
[TR]
[TD]abc123abc[/TD]
[TD="align: right"]18/12/2013
[/TD]
[TD="align: center"]Things [/TD]
[TD="align: right"]492[/TD]
[/TR]
[TR]
[TD]xyz12xy[/TD]
[TD="align: right"]14/9/2014[/TD]
[TD="align: center"]Fame [/TD]
[TD="align: right"]485
[/TD]
[/TR]
[TR]
[TD]qpqpqpqp[/TD]
[TD="align: right"]29/5/2014[/TD]
[TD="align: center"]Door [/TD]
[TD="align: right"]3724[/TD]
[/TR]
</tbody>[/TABLE]
DataSetB1 (each in a separate worksheet named on the value in column B1 i.e. 20131216 in this example)
[TABLE="class: grid, width: 536"]
<colgroup><col><col span="7"></colgroup><tbody>[TR]
[TD]ID
[/TD]
[TD="align: right"]20131216
[/TD]
[TD="align: right"] 20131217
[/TD]
[TD="align: right"]20131218
[/TD]
[TD="align: right"]20131219
[/TD]
[TD="align: right"]20131220[/TD]
[TD="align: right"] 20131221
[/TD]
[TD="align: right"]20131222[/TD]
[/TR]
[TR]
[TD]abc123abc[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]9[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]xyz12xy[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]32[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]1
[/TD]
[/TR]
</tbody>[/TABLE]
DataSetB2 (each in a separate worksheet named on the value in column B1 i.e. 20131223 in this example)
[TABLE="class: grid, width: 512"]
<colgroup><col span="8"></colgroup><tbody>[TR]
[TD]ID
[/TD]
[TD="align: right"]20131223[/TD]
[TD="align: right"] 20131224
[/TD]
[TD="align: right"] 20131225
[/TD]
[TD="align: right"]20131226[/TD]
[TD="align: right"] 20131227
[/TD]
[TD="align: right"] 20131228
[/TD]
[TD="align: right"] 20131229
[/TD]
[/TR]
[TR]
[TD]xyz12xy[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]52[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]9[/TD]
[/TR]
[TR]
[TD="colspan: 2"]qpqpqpqp[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1
[/TD]
[/TR]
</tbody>[/TABLE]
The desired output is a consolidation of all datasetB type worksheets (about 75) with the 1 databaseA worksheet.
Sample output set required
[TABLE="class: grid, width: 1163"]
<colgroup><col><col><col span="16"></colgroup><tbody>[TR]
[TD]ID
[/TD]
[TD]Date
[/TD]
[TD]title[/TD]
[TD]Qty[/TD]
[TD="align: right"]20131216[/TD]
[TD="align: right"]20131217[/TD]
[TD="align: right"]20131218[/TD]
[TD="align: right"]20131219[/TD]
[TD="align: right"]20131220[/TD]
[TD="align: right"]20131221[/TD]
[TD="align: right"]20131222[/TD]
[TD="align: right"]20131223[/TD]
[TD="align: right"]20131224[/TD]
[TD="align: right"]20131225[/TD]
[TD="align: right"]20131226[/TD]
[TD="align: right"]20131227[/TD]
[TD="align: right"]20131228[/TD]
[TD="align: right"]20131229[/TD]
[/TR]
[TR]
[TD]abc123abc[/TD]
[TD="align: right"]18/12/2013[/TD]
[TD]Things [/TD]
[TD="align: right"]492[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]9[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]xyz12xy[/TD]
[TD="align: right"]14/9/2014[/TD]
[TD]Fame [/TD]
[TD="align: right"]485[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]32[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]52[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]9[/TD]
[/TR]
[TR]
[TD]qpqpqpqp[/TD]
[TD="align: right"]29/5/2014[/TD]
[TD]Door [/TD]
[TD="align: right"]3724[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[/TR]
</tbody>[/TABLE]