Ich habe ein Arbeitsblatt, das enthält:
WS1
ID
AlexandG
AlexandG
AlexandG
AlexandG
Wie gehe ich vor, um diese Zellen zu nummerieren:
ID
AlexandG
AlexandG1
AlexandG2
AlexandG3
Jede Hilfe wird geschätzt. Vielen Dank.
Antworten:
1 für die Antwort № 1Hier ist ein kurzes Skript, das ich geschrieben habe. Sie können diesen Code in einem Modul ausführen, und es funktioniert relativ zur Auswahl der ersten Zelle (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