|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub t()
Dim arr
Dim brr(1 To 6, 1 To 2)
arr = Sheets("清单").Range("a1").CurrentRegion
str1 = Sheets(1).Range("a2")
brr(1, 1) = arr(1, 1): brr(1, 2) = arr(1, 2)
brr(3, 1) = arr(1, 3): brr(3, 2) = arr(1, 4)
brr(5, 1) = arr(1, 5): brr(5, 2) = arr(1, 6)
For i = 2 To UBound(arr)
If arr(i, 1) = str1 Then
brr(2, 1) = arr(i, 1): brr(2, 2) = arr(i, 2)
brr(4, 1) = arr(i, 3): brr(4, 2) = arr(i, 4)
brr(6, 1) = arr(i, 5): brr(6, 2) = arr(i, 6)
End If
Next
[g2].Resize(6, 2) = brr
End Sub |
|