Here's the tweaked version of the code and sheet. This will watch for you entering spurious Load # entries and will warn when that has happened.
Option Explicit
Sub LoadListing()
Dim LR As Long, NR As Long, i As Long, Rng As Range
LR = Range("B" & Rows.Count).End(xlUp).Row
Set Rng = Range("Z:Z")
For i = 4 To LR
If Cells(i, "B").Value > 0 Then
On Error Resume Next
NR = Application.Match(Cells(i, "B"), Rng, 0)
If Err = 0 Then
Range(Cells(NR, "AA"), Cells(NR, "AC")).Value = Range(Cells(i, "D"), Cells(i, "F")).Value
Else
MsgBox "Load # " & Cells(i, "B") & " was not found in column Z. Please correct the listing." _
& Chr(13) & Chr(10) & Chr(10) & "Skipping this item and continuing with the rest of the loads..."
End If
End If
Next i
Set Rng = Nothing
End Sub
Bookmarks