1 | | | 2 | | | 3 | | | 4 | | | 5 | | | 6 | | | 7 | | | 8 | | | 9 | | | 10 | | | 11 | | | 12 | | | 13 | | | 14 | | | 15 | | | 16 | | | 17 | | | 18 | | | 19 | | | 20 | | | 21 | | | 22 | | | 23 | | | 24 | | | 25 | | | 26 | | | 27 | | | 28 | | | 29 | | | 30 | | | 31 | | | 32 | | | 33 | | |
| | Sub test() | | Set dict = CreateObject("Scripting.Dictionary") | | With Sheets(1) | | For y = 1 To 10 | | no = .Cells(y, 1) | | For x = 2 To 10 | | tmpkey = .Cells(y, x) | | If tmpkey <> "" Then | | If Not dict.Exists(tmpkey) Then | | dict.Add tmpkey, no | | Else | | dict(tmpkey) _ | | = dict(tmpkey) & "," & no | | End If | | End If | | Next | | | | Next | | | | y = 10 | | For Each m In dict.keys | | .Cells(y , 1) = m | | arr = Split(dict(m), ",") | | x = 2 | | For Each xm In arr | | .Cells(y , x) = xm | | x = x + 1 | | Next | | y = y + 1 | | Next | | End With | | End Sub | | |
|