|
- Sub aa()
- Dim ws As Worksheet
- Dim maxRow As Long
- Columns("D:F").ClearContents
- [d1:f1].Value = Array("凭证类别", "凭证号(起)", "凭证号(止)")
-
- Set ws = ActiveSheet
- maxRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row
- Count = 2
- Cells(Count, 4) = Cells(2, 2)
- Cells(Count, 5) = Cells(2, 1)
-
- For i = 2 To maxRow
- If Cells(i, 2) <> Cells(i + 1, 2) Then
- If Cells(i, 2) <> Cells(i + 1, 2) And Cells(i, 2) <> Cells(i - 1, 2) Then
- Cells(Count, 6) = ""
- Else
- Cells(Count, 6) = Cells(i, 1)
- End If
- Count = Count + 1
- Cells(Count, 4) = Cells(i + 1, 2)
- Cells(Count, 5) = Cells(i + 1, 1)
- End If
- Next i
- End Sub
复制代码 |
|