Im creating a excel booklist for our library and im using userform to insert new entry of books details. After user input the details into userform, I would like to check three items from (ISBNTextBox.Text, TitleTextBox.Text, CallNoTextBox.Text) if the book already exist in our list to avoid duplicate list. Then, if duplicate found, we can check the duplicate data by clicking the button and direct point to the cell of any three data above. Below some code that I already tried but not working. Can someone help me to fix it?
UPDATE: Tried one of those comment solution, its working but only for ISBN(Column E), for title and call number, when click only pointed to cell B1
Private Sub Gotobutton_Click()
Dim oRange As Range, aCell As Range, bCell As Range
Dim ws As Worksheet
Dim ExitLoop As Boolean
Dim SearchString As Variant, FoundAt As String
''On Error GoTo Whoa
Set ws = Worksheets("booklist")
Set oRange = ws.Range("B:B, E:E, F:F")
SearchString = Array(ISBNTextBox.Text, TitleTextBox.Text, CallNoTextBox.Text)
Set aCell = oRange.Find(What:=SearchString, LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not aCell Is Nothing Then
Set bCell = aCell
FoundAt = aCell.Address
Do While ExitLoop = False
Set aCell = oRange.FindNext(After:=aCell)
If Not aCell Is Nothing Then
If aCell.Address = bCell.Address Then Exit Do
FoundAt = FoundAt & ", " & aCell.Address
Else
ExitLoop = True
End If
Loop
End If
''MsgBox "The Search String has been found these locations: " & FoundAt
Application.GoTo Worksheets("booklist").Range(FoundAt)
Exit Sub
''Whoa:
MsgBox Err.Description
End Sub
Let me know if you need xlsm file.