Private Sub CommandButton57_Click()
Dim Obj As Object
Dim wAddST As Variant
Dim w As Variant
ListBox2.Clear
If TextBox1.Value = "" Then Exit Sub
With Sheets("2_用途").Columns("B")
Set Obj = .Cells.Find(What:=TextBox1.Value, _
LookIn:=xlValues, _
lookat:=xlPart, _
MatchByte:=False)
MsgBox Obj
If Not Obj Is Nothing Then
wAddST = Obj.Address
Do
If IsArray(w) Then
ReDim Preserve w(1 To 6, 1 To UBound(w, 2) + 1)
Else
ReDim w(1 To 6, 1 To 1)
End If
w(1, UBound(w, 2)) = Obj.EntireRow.Range("B1").Value
w(2, UBound(w, 2)) = Obj.EntireRow.Range("C1").Value
w(3, UBound(w, 2)) = Obj.EntireRow.Range("D1").Value
w(4, UBound(w, 2)) = Obj.EntireRow.Range("E1").Value
w(5, UBound(w, 2)) = Obj.EntireRow.Range("F1").Value
w(6, UBound(w, 2)) = Obj.EntireRow.Range("G1").Value
Set Obj = .Cells.FindNext(Obj)
If Obj.Address = wAddST Then Exit Do
Loop
End If
End With
If IsArray(w) Then
ListBox2.Column() = w
Else
MsgBox "存在しません。", _
vbOKOnly + vbInformation, "検索"
End If
End Sub