下拉式窗口的 ACTION CHANGE 應該要有第一個窗口的 CHANGE 時要 CLEAR 第二個窗口的內容
這不用寫VBA吧?
2.欄1的資料驗證設定為:
3.欄2的資料驗證設定為:
試看看這樣吧
其中1選單 我是放在Range("A1")
清單的寫法 我是參考錄製巨集後的結果
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Row = 1 And Target.Column = 2 Then
If Range("A1") = "A" Then
With Target.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="C,D,E"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.IMEMode = xlIMEModeNoControl
.ShowInput = True
.ShowError = True
End With
ElseIf Range("A1") = "B" Then
With Target.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="F,G,H"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.IMEMode = xlIMEModeNoControl
.ShowInput = True
.ShowError = True
End With
End If
End If
End Sub