返回列表 上一主題 發帖

[發問] 分類問題

回復 1# ayubbs
  1. Private Sub Worksheet_Change(ByVal Target As Range)
  2. Set d = CreateObject("Scripting.Dictionary")
  3. If Target.Address = "$I$7" Then
  4.     For Each a In Range([C3], [C3].End(xlDown))
  5.       If a = Target Then d(a.Offset(, 1).Value) = ""
  6.     Next
  7.     With Target.Offset(1).Validation
  8.     .Delete
  9.     .Add xlValidateList, , , Join(d.keys, ",")
  10.     End With
  11. End If
  12. End Sub

  13. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  14. Set d = CreateObject("Scripting.Dictionary")
  15. If Target.Address = "$I$7" Then
  16.     For Each a In Range([C3], [C3].End(xlDown))
  17.     d(a.Value) = ""
  18.     Next
  19.     With Target.Validation
  20.     .Delete
  21.     .Add xlValidateList, , , Join(d.keys, ",")
  22.     End With
  23. End If
  24. End Sub
複製代碼
ex.zip (12.76 KB)
學海無涯_不恥下問

TOP

回復 3# ayubbs
重點是你的清單是隨著每個檔案不同還是清單放在一個檔案內,而要其他檔案抓取這些清單作為驗證來源?
學海無涯_不恥下問

TOP

        靜思自在 : 心中常存善解、包容、感思、知足、惜福。
返回列表 上一主題