|
代码如下。。。
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$GU$1" Or Target.Address = "$GY$1" Then
Application.EnableEvents = False
arr = [fh3:gu7]
ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2))
ReDim crr(1 To UBound(arr), 1 To 8)
s = [gu1]
ss = [gy1]
If ss = 1 Then
brr = arr
ElseIf ss = 2 Then
For i = 1 To UBound(arr)
For j = 2 To UBound(arr, 2)
brr(i, j - 1) = arr(i, j)
Next
brr(i, j - 1) = arr(i, 1)
Next
ElseIf ss = s Then
For i = 1 To UBound(arr)
For j = s To UBound(arr, 2)
brr(i, j - ss + 1) = arr(i, j)
Next
For k = 1 To ss - 1
brr(i, j - k) = arr(i, k)
Next
Next
End If
For i = 1 To UBound(brr)
For j = 1 To UBound(brr, 2) Step s
Sum = 0
For k = 0 To s - 1
If brr(i, j + k) <> 0 Then Sum = Sum + 1
Next
crr(i, Int(j / s) + 1) = Sum
Next
Next
[gy3:hf7] = Empty
[gy3:hf7] = crr
Application.EnableEvents = True
Beep
End If
End Sub
|
评分
-
1
查看全部评分
-
|