Een familie van Microsoft-spreadsheetsoftware met hulpmiddelen voor het analyseren, in kaart brengen en communiceren van gegevens.
Dit antwoord is automatisch vertaald. Als gevolg hiervan kunnen er grammaticale fouten of vreemde formuleringen zijn.
Hoi Fedde Schaafsma,
Bedankt voor uw bezoek aan de Microsoft-community.
Het lijkt erop dat je een For each + Next in uw code om alle gevonden cellen te herhalen. Hier is een verbeterde versie van de code, die u kunt aanpassen aan uw behoeften:
Sub ISBN()
Dim ISBN As String
Dim cell As Range
Dim isbnList As Range
Dim isbnCell As Range
' Define the range containing the list of ISBN numbers to be searched
Set isbnList = Range("G1:G100") ' Change this to your actual range
' Loop through each cell in the range
For Each isbnCell In isbnList
ISBN = isbnCell.Value
' Find the ISBN in the specified range
Set cell = Range("F11:F9940").Find(What:=ISBN, LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
' Check if the cell is found
If cell Is Nothing Then
' ISBN not found
MsgBox "ISBN nr " & ISBN & " not found"
' Record the ISBN in the "Not found ISBN nrs" sheet
Sheets("Not found ISBN nrs").Select
ActiveCell.FormulaR1C1 = ISBN
ActiveCell.Offset(1, 0).Select
Else
' Highlight the cell where the ISBN is found
cell.Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End If
' Ensure the original sheet is selected after processing each ISBN
ActiveSheet.Previous.Select
Next isbnCell
End Sub
Laat het me gerust weten als je nog vragen hebt.
Hartelijke groeten
Jonathan Z - MSFT | Specialist in ondersteuning voor de Microsoft-community