|
供参考。如果每组x都从0开始,代码如下:
Sub 提取()
Dim nRow%, Arr(), Brr(), m%, L%
nRow = Range("a1048576").End(xlUp).Row + 1
Arr = Range("a1:b" & nRow).Value
ReDim Brr(-1 To nRow, 1 To 2)
Brr(0, 1) = "x"
Brr(0, 2) = "y"
i = Range("xfd3").End(xlToLeft).Column
If i > 3 Then Range("d2").Resize(nRow, i).ClearContents
For i = 4 To nRow
If i > 4 And Arr(i, 1) = 0 Then
L = L + 1
Brr(-1, 1) = L & " cycle"
Range("b2").Offset(0, L * 2).Resize(m + 2, 2).Value = Brr
Range("b2").Offset(0, L * 2).Resize(1, 2).Merge
m = 0
End If
m = m + 1
Brr(m, 1) = Arr(i, 1)
Brr(m, 2) = Arr(i, 2)
Next
End Sub
|
评分
-
1
查看全部评分
-
|