运行宏后
r1=range(cells(2,1),cells(5,1))
r2=range(cells(6,1),cells(12,1))
- Sub aaa()
- Dim i&, k&, r1, r2
- For i = 2 To [a65536].End(3).Row - 1
- For k = i + 1 To [a65536].End(3).Row
- If Cells(k, 1) <> Cells(i, 1) Then Exit For
- Next k
- If i = 2 Then
- r1 = Range(Cells(i, 1), Cells(k - 1, 1))
- Else
- r2 = Range(Cells(i, 1), Cells(k - 1, 1))
- End If
- i = k - 1
- Next i
- End Sub
复制代码
|