- ©«¤l
- 4901
- ¥DÃD
- 44
- ºëµØ
- 24
- ¿n¤À
- 4916
- ÂI¦W
- 80
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Office 20xx
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_
- µù¥U®É¶¡
- 2010-4-30
- ³Ì«áµn¿ý
- 2025-4-4
               
|
¥»©«³Ì«á¥Ñ Hsieh ©ó 2010-5-11 23:03 ½s¿è
¦^´_ 4# letugo
³o¼Ë¥i¯àn¥Î¨ìVBA»²§U¤~¦æ
Dropdown list.rar (14.06 KB)
- Private Sub Worksheet_Change(ByVal Target As Range)
- Dim Ar()
- Set d = CreateObject("Scripting.Dictionary")
- If Target.Column = 3 Then '«ü©wÄæ¦ì
- With Target.EntireColumn.Validation
- .Delete
- For Each a In Range(Cells(2, Target.Column), Target)
- d(a.Value) = d(a.Value) + 1
- Next
- Do Until d.Count = 0 Or i = 20
- k = Application.Large(d.items, 1)
- k = Application.Match(k, d.items, 0)
- ans = Application.Index(d.keys, k)
- If mystr = "" Then
- mystr = ans
- Else
- mystr = mystr & "," & ans
- End If
- d.Remove ans: i = i + 1
- Loop
- If Not IsError(mystr) And mystr <> "" Then .Add xlValidateList, Formula1:=mystr: .ShowError = False
- End With
- End If
- End Sub
½Æ»s¥N½X |
|