|
Sub test()
On Error Resume Next
Set d = CreateObject("scripting.dictionary")
With Sheets("Data")
r = .Cells(Rows.Count, 1).End(xlUp).Row
arr = .Range("a2:a" & r)
For i = 1 To UBound(arr)
d(Month(arr(i, 1)) & "." & Day(arr(i, 1))) = ""
Next
For Each a In d.keys
Set sh = Sheets.Add(, Sheets(Sheets.Count))
n = n + 1
sh.Name = a
.Rows(1).Copy sh.[a1]
sh.[e1] = "avg-A"
sh.[f1] = "avg-B"
.Range("a" & 2 + 24 * (n - 1)).Resize(24, 3).Copy sh.[a2]
For i = 1 To 24
lja = lja + sh.Cells(i + 1, "b")
ljb = ljb + sh.Cells(i + 1, "c")
If i Mod 6 = 0 Then
m = m + 1
sh.Cells(m + 1, "e") = WorksheetFunction.Round(lja / 6, 2)
sh.Cells(m + 1, "f") = WorksheetFunction.Round(ljb / 6, 2)
lj = 0
End If
Next
m = 0
Next
End With
End Sub |
|