:ROW1はヘッダ行であり、あなたが日と呼ばれる名前付き範囲を持っているし、右側シート]タブをクリックB - >表示のコードをとに下記のコードを貼り付け開いたコードウィンドウ - >ブックをマクロ有効ブックとして保存します。
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
Dim x, dict
Dim i As Long, lr As Long
Dim Rng As Range, Cell As Range
Dim Str As String
lr = Cells(Rows.Count, 1).End(xlUp).Row
Set Rng = Range("A2:A" & lr)
x = Range("Days").Value
Set dict = CreateObject("Scripting.Dictionary")
If Target.Column = 2 And Target.Row > 1 Then
If Target.Offset(0, -1) <> "" Then
For Each Cell In Rng
If Cell <> "" And Cell = Target.Offset(0, -1) Then
If Str = "" Then
Str = Cell.Offset(0, 1).Value
Else
Str = Str & ", " & Cell.Offset(0, 1).Value
End If
End If
Next Cell
For i = 1 To UBound(x, 1)
If InStr(Str, x(i, 1)) = 0 Then
dict.Item(x(i, 1)) = ""
End If
Next i
On Error Resume Next
With Target.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=Join(dict.keys, ",")
End With
End If
End If
End Sub
したがって、B列のセルを選択すると、特定のテスト番号のために既に選択された日数を除いたコードがドロップダウンリストを追加します。列Aの対応するセル
これは、常に順番に選択されている場合にのみ適用されます。ときどき彼らは月と水で選んだ「9012」のようなものではないので、最後にドロップでTue、Sat、Sunが必要です。 – Mike
月曜日に水曜日を選択すると、下のセルには木曜日 - 日曜日(名前水) – yass