Brian Feth
New Member
- Joined
- May 21, 2017
- Messages
- 37
Window 11, Excel 2021 Why wont this run with the If statement (between the question marks) where it is. It runs fine without the If Statement. I get the message "Compile Error: Expected End Sub" while highlighting the "H" in the line, " If Range("H" & FirstVender2Row).Value = "Missing Vender" Then ". Help is always appreciated!
For x = 0 To NumVender1ToFill
ChosenDescript = Range("J" & FirstVender1Row).Value
Do Until FirstVender2Row > LastVender2Row
Vender = Range("H" & FirstVender2Row).Value
'????????????????????????????????????????????????????????????????????
If Range("H" & FirstVender2Row).Value = "Missing Vender" Then
Sub MsgBoxAbortRetryIgnore()
MsgBox "Missing Vender, Press Abort, Hand Fill in Vender", vbAbortRetryIgnore
End Sub
End If
'???????????????????????????????????????????????????????????????????
If InStr(ChosenDescript, Vender) <> 0 Then 'Match, Positive result, True
Range("H" & FirstVender1Row).Value = Vender 'Fills Vender name adjacent to Description
FirstVender2Row = Range("H595").Row 'Resets the Vender row
FirstVender1Row = FirstVender1Row - 1
Exit Do
ElseIf InStr(ChosenDescript, Vender) = 0 Then 'No match, negitive result, False
FirstVender2Row = FirstVender2Row + 1
End If
Loop
Next x
For x = 0 To NumVender1ToFill
ChosenDescript = Range("J" & FirstVender1Row).Value
Do Until FirstVender2Row > LastVender2Row
Vender = Range("H" & FirstVender2Row).Value
'????????????????????????????????????????????????????????????????????
If Range("H" & FirstVender2Row).Value = "Missing Vender" Then
Sub MsgBoxAbortRetryIgnore()
MsgBox "Missing Vender, Press Abort, Hand Fill in Vender", vbAbortRetryIgnore
End Sub
End If
'???????????????????????????????????????????????????????????????????
If InStr(ChosenDescript, Vender) <> 0 Then 'Match, Positive result, True
Range("H" & FirstVender1Row).Value = Vender 'Fills Vender name adjacent to Description
FirstVender2Row = Range("H595").Row 'Resets the Vender row
FirstVender1Row = FirstVender1Row - 1
Exit Do
ElseIf InStr(ChosenDescript, Vender) = 0 Then 'No match, negitive result, False
FirstVender2Row = FirstVender2Row + 1
End If
Loop
Next x