-
this is the other variation of code, this error keeps saying "object required" on line (strSearch = Partnumber2.Text)
Private Sub parts2_Click()
Set xSht = Sheets("Database")
lastrow = xSht.Range("A" & Rows.Count).End(xlUp).row
strSearch = Partnumber2.Text
Set aCell = xSht.Range("A1:A" & lastrow).Find(What:=strSearch, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not aCell Is Nothing Then
GoTo PartSearch2valid
Else
MsgBox "Part number not in Database."
End If
Exit Sub
PartSearch2valid:
Dim i As Integer
'lstResults.ColumnCount = 4
'lstResults.ColumnWidths = "60;60;60;0"
ListBox2.Clear
For i = 1 To lastrow
item_in_review = Sheets("database").Range("A" & i)
If item_in_review = Partnumber2.Text Then
ListBox2.AddItem
With ListBox2
.List(.ListCount - 1, 0) = rngToFind.Value 'part number
.List(.ListCount - 1, 1) = rngToFind.Offset(0, 1).Value 'desc
.List(.ListCount - 1, 2) = rngToFind.Offset(0, 2).Value 'stor loc
.List(.ListCount - 1, 3) = rngToFind.Offset(0, 3).Value 'bin loc
.List(.ListCount - 1, 4) = rngToFind.Offset(0, 4).Value 'qty
.List(.ListCount - 1, 5) = rngToFind.Offset(0, 5).Value 'mfg
.List(.ListCount - 1, 6) = rngToFind.Offset(0, 7).Value 'pm name
End With
End If
Next i
End Sub
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules