一組數(shù)據(jù)如圖 結(jié)果 基礎(chǔ)數(shù)據(jù)是單獨(dú)的一張表 結(jié)果是去掉重復(fù)的 按順序依次排列 請(qǐng)問 這個(gè)怎么實(shí)現(xiàn),? 啥也別說了 看代碼 秒殺 就是這么給力 Option Explicit Sub 字典去重冒泡排序() Dim arr, dic, brr, i%, Min, k%, j% arr = Range('A1').CurrentRegion '相連裝數(shù)組 Set dic = CreateObject('scripting.dictionary') '后期綁定字典 For i = 2 To UBound(arr) '循環(huán) dic(arr(i, 1)) = '' '裝字典 Next brr = dic.keys '讀出關(guān)鍵字 Min = brr(0) '賦值 For k = 0 To UBound(brr) For j = k + 1 To UBound(brr) If brr(k) > brr(j) Then Min = brr(k) '關(guān)鍵點(diǎn)交換 brr(k) = brr(j) brr(j) = Min End If Next Next [c3].Resize(1, 10) = brr End Sub 操作簡單才是硬道理,!
|
|