Wypróbuj poniższy kod.
Sub michal()
Dim i As Long
For i = 1 To Cells(Rows.Count, 1).End(xlUp).Row
If IsNumeric(Cells(i, 1)) And Cells(i, 1) <> "" Then
Cells(i + 19, "I") = "=average(H" & i & ":H" & i + 15 & ")"
Cells(i + 20, "I") = "=STDEV(H" & i & ":H" & i + 15 & ")"
Cells(i - 5, 4) = Cells(i + 16, 9)
Cells(i - 5, 5) = Cells(i + 17, 9)
Cells(i - 5, 6) = Cells(i + 18, 9)
Cells(i - 5, 7) = Cells(i + 19, 9)
Cells(i - 5, 8) = Cells(i + 20, 9)
i = i + 19
End If
Next i
End Sub |