- 帖子
- 4901
- 主題
- 44
- 精華
- 24
- 積分
- 4916
- 點名
- 142
- 作業系統
- Windows 7
- 軟體版本
- Office 20xx
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台北
- 註冊時間
- 2010-4-30
- 最後登錄
- 2026-7-16
                
|
回復 5# totes
不須使用範圍作清單- Sub ex()
- Set d = CreateObject("Scripting.Dictionary")
- C = InputBox("輸入開頭字元", , "TC")
- ar = Range("E2", [E65536].End(xlUp)).Value
- For Each a In ar
- If a Like C & "*" Then d(a) = "" '不重複符合規則
- Next
- If d.Count = 0 Then MsgBox "無符合資料": Exit Sub
- With Range("G11").Validation
- .Delete
- .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
- xlBetween, Formula1:=Join(d.keys, ",")
- .IgnoreBlank = True
- .InCellDropdown = True
- .InputTitle = ""
- .ErrorTitle = ""
- .InputMessage = ""
- .ErrorMessage = ""
- .IMEMode = xlIMEModeNoControl
- .ShowInput = True
- .ShowError = True
- End With
- End Sub
複製代碼 |
|