- 帖子
- 53
- 主題
- 16
- 精華
- 0
- 積分
- 74
- 點名
- 0
- 作業系統
- windows xp
- 軟體版本
- OFFICE 2000
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2010-6-6
- 最後登錄
- 2015-12-10
|
本帖最後由 gca78000 於 2015-11-19 13:42 編輯
回復 3# gca78000
姓氏搜尋.rar (15.52 KB)
請問如下Private Sub ComboBox1_Change()
Dim A As Range
Set d = CreateObject("Scripting.Dictionary")
With ActiveSheet
.Cells.Interior.ColorIndex = xlNone
For Each A In .Range("P4:P25,R4:R25,T4:T25,V4:V25")
If A = ComboBox1.Text Then d(A.Address(0, 0, xlA1)) = "": A.Interior.ColorIndex = 6
Next
End With
Unload Me
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_Click()
End Sub
Private Sub UserForm_Initialize()
Set d = CreateObject("Scripting.Dictionary")
With ActiveSheet
For Each A In .Range("P4:P25,R4:R25,T4:T25,V4:V25")
If A <> "" Then d(A.Value) = ""
Next
Label1.Caption = .Name
.Cells.Interior.ColorIndex = xlNone
End With
ComboBox1.List = d.keys
End Sub
P4:P25可搜尋到而R4:R25後卻蒐尋不到請指導謝謝 |
|