|
仅供参考
- Sub 提取()
- Dim arr, brr(1 To 10000, 1 To 4)
- With Worksheets("数据源")
- rw = .[b65536].End(3).Row
- arr = .Range("a3:ad" & rw)
- For i = 1 To UBound(arr)
- n = n + 1
- For j = 1 To UBound(arr, 2)
- brr(n, 1) = arr(i, 3)
- brr(n, 2) = arr(i, 2)
- brr(n, 3) = arr(i, 6)
- brr(n, 4) = arr(i, 30)
- Next
- Next
- End With
- With Worksheets("提取数据")
- .[a2].Resize(n, 4) = brr
- rw = .[b65536].End(3).Row
- arr = .Range("b1:d" & rw)
- For i = 2 To UBound(arr) - 1
- For x = i + 1 To UBound(arr)
- If arr(x, 2) = "" Then
- Cells(x, 3) = arr(i, 2)
- Else
- i = x
- End If
- If arr(x, 3) = "" Then
- Cells(x, 4) = arr(i, 3)
- Else
- i = x
- End If
- Next
- If x >= UBound(arr) Then Exit For
- Next
- End With
- MsgBox "提取数据完成!"
- End Sub
复制代码 |
|