- 帖子
- 64
- 主題
- 18
- 精華
- 0
- 積分
- 98
- 點名
- 0
- 作業系統
- Mac
- 軟體版本
- Office 365
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2010-6-12
- 最後登錄
- 2023-12-17
|
- Sub test()
- Dim dic As Object, data, i%
- Set dic = CreateObject("scripting.dictionary")
- data = Range(Cells(1, 1), Cells(1, 2).End(4))
- For i = 1 To UBound(data)
- If Not dic.exists(data(i, 1)) Then
- dic.Add data(i, 1), data(i, 2)
- Else
- If InStr(dic(data(i, 1)), data(i, 2)) = 0 Then
- dic(data(i, 1)) = dic(data(i, 1)) & " , " & data(i, 2)
- End If
- End If
- Next
- Cells(1, 3).Resize(dic.Count, 1) = Application.Transpose(dic.keys)
- Cells(1, 4).Resize(dic.Count, 1) = Application.Transpose(dic.items)
- Columns(4).TextToColumns Destination:=Cells(1, 4), OtherChar:=" , "
- Cells.Columns.AutoFit
- Set dic = Nothing
- End Sub
複製代碼 以上此代碼,如何把結果得來是以每個欄代替" , "
以現時得出結果,十分混亂
謝謝幫忙 |
|