當前位置:成語大全網 - 新華字典 - Excel COMBOX控件顯示不重復的問題求助

Excel COMBOX控件顯示不重復的問題求助

僅供參考

Private Sub UserForm_Initialize()

With ListView1

.ColumnHeaders.Add , , "俷靡", 38

.ColumnHeaders.Add , , "脹撰", Width / 6

.ColumnHeaders.Add , , "齬靡", Width / 6

.View = lvwReport 'listivew腔珆尨跡宒峈惆桶跡宒

'.Sorted = True 'listivew腔齬唗扽俶峈杅硉蠶苤善湮

'.SortKey = 0 'listivew齬唗腔坰竘峈 '馱瘍', 植0羲宎

.Gridlines = True '珆尨厙跡盄

.FullRowSelect = True '埰勍淕俴恁笢

End With

'ComboBox1.AddItem ˋˋˋ

r = Sheet1.Cells(65536, 11).End(xlUp).Row

For i = 12 To 13

If Sheet1.Cells(65536, i).End(xlUp).Row > r Then r = Sheet1.Cells(65536, i).End(xlUp).Row 'K:M最後壹行有數據的列

Next i

Set dic = CreateObject("scripting.dictionary") '字典

For Each c In Sheet1.Range("K1:M" & r)

If Not dic.exists(c.Value & "") And Len(c) > 0 Then dic.Add c.Value, ""

Next c

a = dic.keys

For i = 0 To dic.Count - 1

ComboBox1.AddItem a(i)

Next i

Set dic = Nothing

End Sub