
excel
vbnetSub AutoNumber()Dim i As LongDim a As Longa = 1For i = 1 To Range("A2").End(xlDown).RowIf Cells(i, "A") = "A" ThenCells(i, "B") = Str(a) & "1"a = a + 1End IfIf Cells(i, "A") = "B" ThenCells(i, "B") = Str(a) & "2"a = a + 1End IfIf Cells(i, "A") = "C" ThenCells(i, "B") = Str(a) & "3"a = a + 1End IfIf Cells(i, "A") = "D" ThenCells(i, "B") = Str(a) & "4"a = a + 1End IfIf Len(Cells(i, "B")) = 2 ThenCells(i, "B") = Left(CellCopyright © 2025 IZhiDa.com All Rights Reserved.
知答 版权所有 粤ICP备2023042255号