- 帖子
- 4901
- 主題
- 44
- 精華
- 24
- 積分
- 4916
- 點名
- 152
- 作業系統
- Windows 7
- 軟體版本
- Office 20xx
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台北
- 註冊時間
- 2010-4-30
- 最後登錄
- 2025-6-24
               
|
2#
發表於 2014-1-17 14:43
| 只看該作者
回復 1# ayubbs - Private Sub Worksheet_Change(ByVal Target As Range)
- Set d = CreateObject("Scripting.Dictionary")
- If Target.Address = "$I$7" Then
- For Each a In Range([C3], [C3].End(xlDown))
- If a = Target Then d(a.Offset(, 1).Value) = ""
- Next
- With Target.Offset(1).Validation
- .Delete
- .Add xlValidateList, , , Join(d.keys, ",")
- End With
- End If
- End Sub
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- Set d = CreateObject("Scripting.Dictionary")
- If Target.Address = "$I$7" Then
- For Each a In Range([C3], [C3].End(xlDown))
- d(a.Value) = ""
- Next
- With Target.Validation
- .Delete
- .Add xlValidateList, , , Join(d.keys, ",")
- End With
- End If
- End Sub
複製代碼
ex.zip (12.76 KB)
|
|