- Sub test()
- ar = [a1].CurrentRegion
- ReDim arr(1 To UBound(ar), 1 To 3)
- For i = 1 To UBound(ar)
- If Len(ar(i, 1)) Then
- n = n + 1
- arr(n, 3) = arr(n, 3) & ar(i, 2)
- ElseIf ar(i, 1) = "" And Len(ar(i, 2)) Then
- arr(n, 3) = arr(n, 3) & ar(i, 2)
- End If
- Next i
- [a1].Resize(n, 3) = arr
- End Sub
- Sub test()
- ar = [a1].CurrentRegion
- ReDim arr(1 To UBound(ar), 1 To 3)
- For i = 1 To UBound(ar)
- If Len(ar(i, 1)) Then
- n = n + 1
- arr(n, 3) = arr(n, 3) & ar(i, 2)
- ElseIf ar(i, 1) = "" And Len(ar(i, 2)) Then
- arr(n, 3) = arr(n, 3) & ar(i, 2)
- End If
- Next i
- [a1].Resize(n, 3) = arr
- End Sub
复制代码 |