Here is something I have mashed together, is assumes that table2 is made of just headers (dates) and resides in its own sheet.
I have mashed this together as I am not quite sure what you are after, this is what I think you need and should give a better starting point.
Sub FillSheet()
Dim sh As Worksheet, tbl2Paste As Range
Dim endRow As Long
Dim newTBLrng As Range, rCell As Range
Dim tmpRng As Range, formulaCell As Range
For Each sh In ThisWorkbook.Worksheets ' loop through all sheets in the workbook
If Left(sh.Name, 5) = "Sheet" Then ' just somethig I did to exclude the sheet with table2 on
Set tbl2Paste = sh.Range("A1").End(xlToRight).Offset(, 2) ' set where to paste table2
endRow = sh.Range("A" & Rows.Count).End(xlUp).Row - 1 ' sets the endrow of table1
ShTbl2.Range("A1:C1").Copy ' copy table2 from a sheet I renamed
tbl2Paste.PasteSpecial xlAll ' paste table2 to the sheet
Set newTBLrng = sh.Range(tbl2Paste, tbl2Paste.End(xlToRight)) ' set the size of the table2 headers
For Each rCell In newTBLrng.Cells ' loop through the pasted table2 header rows (dates)
Set tmpRng = sh.Range(rCell.Offset(1, 0), rCell.Offset(endRow, 0)) ' set range below table2 header to end of table1 data
For Each formulaCell In tmpRng.Cells ' loop through this temp range
'have a choice of placing formula of result below
'formulaCell.Value = WorksheetFunction.AverageIf(sh.Range(sh.Cells(1, 1), sh.Cells(1, tbl2Paste.Column - 2)), rCell.Value, sh.Range(sh.Cells(formulaCell.Row, 1), sh.Cells(formulaCell.Row, tbl2Paste.Column - 2)))
formulaCell.Formula = "=AverageIf(" & sh.Range(sh.Cells(1, 1), sh.Cells(1, tbl2Paste.Column - 2)).Address & "," & rCell.Address & "," & sh.Range(sh.Cells(formulaCell.Row, 1), sh.Cells(formulaCell.Row, tbl2Paste.Column - 2)).Address & ")"
Next formulaCell
Next rCell
End If
Next sh
End Sub
Hope this helps