|
まつさん、おはようございます。
こんな感じでどうでしょ?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address(0, 0) = "B1" Then
With Range("B1").Validation
.Delete
If Range("A1").Value = 1 Then
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$AA$1:$AA$20"
ElseIf Range("A1").Value = 2 Then
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$AB$1:$AB$20"
ElseIf Range("A1").Value = 3 Then
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$AC$1:$AC$20"
ElseIf Range("A1").Value = 4 Then
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$AD$1:$AD$20"
End If
End With
End If
End Sub
|
|