Private Sub 技術検索ボタン_Click() Dim sn As String '検索番号の設定 sn = 技術検索番号.Value '検索の処理 With Sheets("全データ") Set found = Worksheets("全データ").Range("B:B").Find(sn, , LookAt:=xlWhole) '見つからない場合の処理 If found Is Nothing Then MsgBox ("技術コードが見つかりません。5桁の数字を正しく入力してください。") '見つかった場合の処理(フォーム上のtextboxに値を代入) Else Me.会社名表示.Value = .Cells(found.Row, 4) Me.処理機郵便番号表示.Value = .Cells(found.Row, 5) Me.処理機住所表示.Value = .Cells(found.Row, 6) Me.電話番号表示.Value = .Cells(found.Row, 10) Me.メールアドレス表示.Value = .Cells(found.Row, 9) Me.事業区分表示.Value = .Cells(found.Row, 11) End If End With End Sub