For R = 2 To LastRow If Cells(R, "D").Value = Val(TextBox1.Value) Then For c = 2 To LastClm If Cells(R, c).Value <> "" Then Moji = Moji & Cells(2, c).Value & "," End If Next c Exit For End If Next R
If Moji <> "" Then TextBox2.Value = Left(Moji, Len(Moji) - 1) Else MsgBox TextBox1.Value & " は無し", vbCritical + vbOKOnly, "確認" TextBox2.Value = "" End If
End Sub -------------------------------------------------------- Private Sub CommandButton2_Click()