Имам Работен лист, който съдържа:
WS1
ID
AlexandG
AlexandG
AlexandG
AlexandG
Как да направя това, че тези клетки да имат автоматично име:
ID
AlexandG
AlexandG1
AlexandG2
AlexandG3
Всяка помощ е оценена. Благодаря.
Отговори:
1 за отговор № 1Ето един бърз сценарий, който написах. Можете да стартирате този код в модул и работи по отношение на вас, като изберете първата клетка (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