ndsutherland
Active Member
- Joined
- Jan 30, 2015
- Messages
- 384
Code:
Private Sub InventoryList_LostFocus()
Dim i As Range
If ActiveSheet.Name = "Order Form" Then
For Each i In ActiveSheet.Range("F2:F" & ActiveSheet.Range("F" & Rows.Count).End(xlUp).Row)
On Error GoTo Other
Cells(i.Row, 5) = Sheets("Inventory").Range("A" & WorksheetFunction.Match(i, Sheets("Inventory").Range("C:C"), 0))
Cells(i.Row, 7) = Sheets("Inventory").Range("D" & WorksheetFunction.Match(i, Sheets("Inventory").Range("C:C"), 0))
Cells(i.Row, 8) = Sheets("Inventory").Range("F" & WorksheetFunction.Match(i, Sheets("Inventory").Range("C:C"), 0))
GoTo Either:
Other:
On Error GoTo 0
On Error GoTo ErrExit
[COLOR=#ff0000] Cells(i.Row, 5) = Sheets("Other").Range("A" & WorksheetFunction.Match(i, Sheets("Other").Range("C:C"), 0))[/COLOR]
Cells(i.Row, 7) = Sheets("Other").Range("D" & WorksheetFunction.Match(i, Sheets("Other").Range("C:C"), 0))
Cells(i.Row, 8) = Sheets("Other").Range("F" & WorksheetFunction.Match(i, Sheets("Other").Range("C:C"), 0))
Either:
Cells(i.Row, 1) = "SO-00000000"
Cells(i.Row, 2) = "TBD"
Next i
End If
ErrExit:
End Sub
My GoTo Other works just fine, but my code breaks (if match isn't found) on the highlighted line. What am I doing wrong?
code break setting set to "break on unhandled error" (I have tried "break in class module", not sure what that means, but it still doesn't work)
InventoryList is an ActiveX Comb Box
Last edited: