|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub test()
Dim arr As Variant
arr = Sheets("原来数据").UsedRange
tj = "<>[]/"
ReDim brr(1 To UBound(arr, 1) * UBound(arr, 2), 1 To 2)
m = 1
n = 1
For i = 1 To UBound(arr, 1)
For j = 1 To UBound(arr, 2)
If arr(i, j) <> "" Then
brr(m, n) = arr(i, j)
If InStr(tj, Left(arr(i, j), 1)) > 0 Then
n = 3
Else
n = n + 1
End If
If n = 3 Then
n = 1
m = m + 1
End If
End If
Next
Next
Sheets("想要的结果").[C1].Resize(UBound(brr, 1), UBound(brr, 2)) = brr
End Sub
|
|