Hi, I'm fairly new to VBA so bare with me
I don't understand why it it throwing up this error when you can clearly see a While followed by Wend?
Compile Error: Wend without While
'Check
counter = 2
While wsMaster.Cells(counter, 2) <> ""
If IsError(Application.VLookup(wsMaster.Cells(counter, 2).Value, wsUpdate.Range("B:B"), 1, False)) = False Then
'checks if it has been deleted
If IsError(Application.VLookup(wsUpdate.Cells(counter, 2).Value, wsMaster.Range("B:B"), 1, False)) = False Then
'checks if it is a new part
If (Application.VLookup(wsMaster.Cells(counter, 2).Value, wsUpdate.Range("B:G"), 3, False)) <> Application.VLookup(wsUpdate.Cells(counter, 2).Value, wsMaster.Range("B:G"), 3, False) Then
wsMaster.Cells(counter, 4).Interior.Color = RGB(255, 155, 0)
If (Application.VLookup(wsMaster.Cells(counter, 2).Value, wsUpdate.Range("B:G"), 4, False)) <> Application.VLookup(wsUpdate.Cells(counter, 2).Value, wsMaster.Range("B:G"), 4, False) Then
wsMaster.Cells(counter, 5).Interior.Color = RGB(255, 155, 0)
If (Application.VLookup(wsMaster.Cells(counter, 2).Value, wsUpdate.Range("B:G"), 5, False)) <> Application.VLookup(wsUpdate.Cells(counter, 2).Value, wsMaster.Range("B:G"), 5, False) Then
wsMaster.Cells(counter, 5).Interior.Color = RGB(255, 155, 0)
If (Application.VLookup(wsMaster.Cells(counter, 2).Value, wsUpdate.Range("B:G"), 6, False)) <> Application.VLookup(wsUpdate.Cells(counter, 2).Value, wsMaster.Range("B:G"), 6, False) Then
wsMaster.Cells(counter, 5).Interior.Color = RGB(255, 155, 0)
End If
End If
counter = counter + 1
Wend
I don't understand why it it throwing up this error when you can clearly see a While followed by Wend?
Compile Error: Wend without While
'Check
counter = 2
While wsMaster.Cells(counter, 2) <> ""
If IsError(Application.VLookup(wsMaster.Cells(counter, 2).Value, wsUpdate.Range("B:B"), 1, False)) = False Then
'checks if it has been deleted
If IsError(Application.VLookup(wsUpdate.Cells(counter, 2).Value, wsMaster.Range("B:B"), 1, False)) = False Then
'checks if it is a new part
If (Application.VLookup(wsMaster.Cells(counter, 2).Value, wsUpdate.Range("B:G"), 3, False)) <> Application.VLookup(wsUpdate.Cells(counter, 2).Value, wsMaster.Range("B:G"), 3, False) Then
wsMaster.Cells(counter, 4).Interior.Color = RGB(255, 155, 0)
If (Application.VLookup(wsMaster.Cells(counter, 2).Value, wsUpdate.Range("B:G"), 4, False)) <> Application.VLookup(wsUpdate.Cells(counter, 2).Value, wsMaster.Range("B:G"), 4, False) Then
wsMaster.Cells(counter, 5).Interior.Color = RGB(255, 155, 0)
If (Application.VLookup(wsMaster.Cells(counter, 2).Value, wsUpdate.Range("B:G"), 5, False)) <> Application.VLookup(wsUpdate.Cells(counter, 2).Value, wsMaster.Range("B:G"), 5, False) Then
wsMaster.Cells(counter, 5).Interior.Color = RGB(255, 155, 0)
If (Application.VLookup(wsMaster.Cells(counter, 2).Value, wsUpdate.Range("B:G"), 6, False)) <> Application.VLookup(wsUpdate.Cells(counter, 2).Value, wsMaster.Range("B:G"), 6, False) Then
wsMaster.Cells(counter, 5).Interior.Color = RGB(255, 155, 0)
End If
End If
counter = counter + 1
Wend