本帖最后由 YZC51 于 2019-5-19 12:24 编辑
学习老师的代码结合排名函数做的,谢谢老师!!!
Sub 按钮1_Click()
Dim arr, k0, brr(), crr()
k0 = 6
For m = 0 To 3
arr = [a5].Offset(m * 9 + 1, 1).Resize(k0, k0)
ReDim brr(1 To k0, 1 To 3)
For i = 1 To k0
If brr(i, 1) = "" Then brr(i, 1) = 0
For j = 1 To k0
brr(i, 3) = 0
temp = Hour(arr(i, j)) - Hour(arr(j, i))
brr(i, 2) = brr(i, 2) + temp
If temp > 0 Then brr(i, 1) = brr(i, 1) + 1: brr(i, 3) = brr(i, 3) - 0.02 Else brr(i, 3) = brr(i, 3) + 0.02
brr(i, 3) = brr(i, 3) + brr(i, 2) / 100 + brr(i, 1)
Next
Next
[a5].Offset(m * 9 + 1, k0 + 1).Resize(k0, 3) = brr
Next m
End Sub
楼主如果满意,请鲜花鼓励后上传附件!
|