|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 集中()
Dim i, j, m, p, irow
Dim arr, brr
irow = Sheet1.[b65536].End(xlUp).Row
arr = Sheet1.Range("a1:f" & irow)
ReDim brr(1 To irow - 1, 1 To 6)
ReDim crr(1 To irow - 1, 1 To 6)
Sheet1.[i1].Resize(irow, 6).Clear
For i = 2 To UBound(arr)
If Sheet1.Cells(i, 2).Interior.Color <> RGB(255, 255, 255) Then
m = m + 1
For j = 1 To 6
brr(m, j) = arr(i, j)
Next
Else
p = p + 1
For j = 1 To 6
crr(p, j) = arr(i, j)
Next
End If
Next
Sheet1.[a1].Resize(1, 6).Copy Sheet1.[i1]
Sheet1.[i2].Resize(p, 6) = crr
Sheet1.Cells(2 + p, 9).Resize(m, 6) = brr
Sheet1.Cells(2 + p, 9).Resize(m, 6).Interior.Color = vbRed
End Sub
|
|