VBA to pull together data from multiple worksheets by name and column heading

Dex_Excel

New Member
Joined
Jul 12, 2017
Messages
1
Hi, Im currently looking to to create a macro that will pull together entries from multiple worksheets and paste them into a single table on my main worksheets. This involves matching the names in column A to the names on worksheets for each month and matching the correct monthly value based on the headers above.

eg. the output is a table like so with every end of working week and colleague

[TABLE="width: 500"]
<tbody>[TR]
[TD]Colleague[/TD]
[TD]7/7/17[/TD]
[TD]14/7/17[/TD]
[TD]21/7/17[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 478"]
<colgroup><col><col span="4"></colgroup><tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]
and the data itself is split across similar tables on multiple worksheets

My current code is just manually copying each row and pasting it like so with repeats of the same code for each individual

Sub report1()
'
' report1 Macro
' gathering rag statuses
'Application.ScreenUpdating = False
Sheets("July 2017").Select
Range("G50:J50").Select
Selection.Copy
Sheets("Sheet2").Select
Range("B19").Select
ActiveSheet.Paste
Sheets("August 2017").Select
Range("G50:J50").Select
Selection.Copy
Sheets("Sheet2").Select
Range("F19").Select
ActiveSheet.Paste
Sheets("September 2017").Select
Range("G50:K50").Select
Selection.Copy
Sheets("Sheet2").Select
Range("J19").Select
ActiveSheet.Paste
Sheets("October 2017").Select
Range("G50:J50").Select
Selection.Copy
Sheets("Sheet2").Select
Range("O19").Select
ActiveSheet.Paste
Sheets("November 2017").Select
Range("G50:J50").Select
Selection.Copy
Sheets("Sheet2").Select
Range("S19").Select
ActiveSheet.Paste
Sheets("December 2017").Select
Range("G50:K50").Select
Selection.Copy
Sheets("Sheet2").Select
Range("W19").Select
ActiveSheet.Paste
Range("B4:AA19").Select
Application.ScreenUpdating = True
End Sub
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top