Excel自动编号
我有一个工作表,其中包含:
WS1
ID AlexandG AlexandG AlexandG AlexandG
如何让这些单元格自动编号:
ID AlexandG AlexandG1 AlexandG2 AlexandG3
任何帮助表示赞赏。 谢谢。
这是我写的一个快速脚本。 你可以在模块中运行这个代码,它相对于你select第一个单元格(AlexandG)。
Sub ChangeNameModule() Dim count As Integer ' to keep track of current number to be appended to cell's value count = 0 Do While Not (ActiveCell.value = None) ' stop running when the cell is empty If count = 0 Then ' do not add count to the cell Else: ActiveCell.value = "" & ActiveCell.value & count ' append count to the cell's value End If ActiveCell.Offset(1, 0).Range("A1").Select ' selects the cell below count = count + 1 Loop End Sub