| 
    
     |  | VBAのSelect Caseは条件式が一つしか指定できないんですね。 ありゃ〜、今まで気が付きませんでした。
 文字列連結で苦肉の策を講じて対処。
 
 Sub 担当者の自動振分け()
 Dim lngRow As Long
 Dim lngRowLast As Long
 Dim StrAandB As String
 '
 With ActiveSheet
 lngRowLast = .Range("A" & .Rows.Count).End(xlUp).Row
 lngRow = 2
 Do While lngRow <= lngRowLast
 ' With .Range("A" & lngRow) ←取り敢えず、不要ということで。
 
 ↓A列とB列を半角スペースを間に入れて文字列連結。
 StrAandB = .Range("A" & lngRow).Value & " " & CStr(.Range("B" & lngRow).Value)
 Select Case StrAandB
 Case "A 1"
 .Range("K" & lngRow).Value = "山田さん"
 Case "A 2"
 .Range("K" & lngRow).Value = "佐藤さん"
 Case "A 3"
 .Range("K" & lngRow).Value = "鈴木さん"
 Case "Z 30"
 .Range("K" & lngRow).Value = "岡本さん"
 Case Else
 MsgBox "A・B列の組み合わせの値 該当なし! " & lngRow & "行目"
 Exit Sub
 End Select
 ' End With
 lngRow = lngRow + 1
 Loop
 End With
 End Sub
 
 |  |