|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub TEST()
ARR = Sheets("资料输入区").UsedRange
R = 7
For I = 2 To UBound(ARR)
If ARR(I, 4) = [C5] Then
If ARR(I, 12) <> S Then
C = 1
N = N + 1
M = 1
R = R + 2
Cells(R, 1) = N
Cells(R, 2) = ARR(I, 9)
Cells(R, 5) = ARR(I, 12)
Cells(R, 9) = ARR(I, 10)
S = ARR(I, 12)
SJ = ARR(I, 5)
Cells(R, 10) = ARR(I, 5)
Cells(R, 12) = ARR(I, 30)
Cells(R, 16) = ARR(I, 11)
Cells(R, 34) = M
Else
If ARR(I, 5) <> SJ Then
SJ = ARR(I, 5)
C = C + 1
M = M + 1
If C = 4 Then C = 1
Cells(R + Int((M - 1) / 3), C * 8 + 2) = ARR(I, 5)
Cells(R + Int((M - 1) / 3), C * 8 + 4) = ARR(I, 30)
Cells(R + Int((M - 1) / 3), C * 8 + 8) = ARR(I, 11)
Cells(R, 34) = M
End If
End If
End If
Next
End Sub
|
|