Generate ID for cells containing same values
Closed
cris01
-
Apr 21, 2015 at 06:34 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Apr 21, 2015 at 11:08 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Apr 21, 2015 at 11:08 AM
Related:
- Generate ID for cells containing same values
- Yahoo generate app password not available right now - Yahoo Mail Forum
- Based on the values in cells b77 ✓ - Excel Forum
- Excel arrow keys not moving cells - Guide
- Excel macro to create new sheet based on value in cells - Guide
- Arrow keys scrolling in Excel ✓ - Excel Forum
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Apr 21, 2015 at 11:08 AM
Apr 21, 2015 at 11:08 AM
Hi Cristina,
The code below will do as requested.
The names are assumed to be in column A.
The ID's are assumed to be in column B.
Here is the code:
Best regards,
Trowa
The code below will do as requested.
The names are assumed to be in column A.
The ID's are assumed to be in column B.
Here is the code:
Sub RunMe() Dim lRow, x As Integer lRow = Range("A" & Rows.Count).End(xlUp).Row x = 1 For Each cell In Range("A2:A" & lRow) If cell.Offset(0, 1) = vbNullString Then With Range("A2:A" & lRow) Set c = .Find(cell.Value, LookIn:=xlValues) If Not c Is Nothing Then firstAddress = c.Address Do c.Offset(0, 1).Value = x Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address <> firstAddress End If End With x = x + 1 End If Next cell End Sub
Best regards,
Trowa