Hi
I want my code to exit as soon as the condition of the if statement within the for loop are met and the message box appears (shown in yellow below).
When exit sub is added, it exits after the messagebox but the rest of my code does not run when the conditions are not met, and if I remove Exit sub then it continues to run when the conditions are met. Also moving Exit sub before Next x creates an error of Next without For.
Is there an easy fix for this problem?
Thank you
I want my code to exit as soon as the condition of the if statement within the for loop are met and the message box appears (shown in yellow below).
When exit sub is added, it exits after the messagebox but the rest of my code does not run when the conditions are not met, and if I remove Exit sub then it continues to run when the conditions are met. Also moving Exit sub before Next x creates an error of Next without For.
Is there an easy fix for this problem?
Thank you
Rich (BB code):
If duplicatesheet4.Range("Y11").Value > duplicatesheet4.Range("Y16").Value Then
MsgBox ("There are not enough")
Exit Sub
Else
duplicatesheet4.Range("K2:V" & Lastrow).Value = duplicatesheet4.Range("K2:V" & Lastrow).Value
For x = 2 To duplicatesheet4.Range("K2" & Lastrow).End(xlUp).Row
If duplicatesheet4.Range("K" & x).Value = "Investigation needed" Or duplicatesheet4.Range("K" & x).Value = "Please choose Y/N" Then MsgBox ("Please update all entries in column K using Y or N")
Next x
Exit sub
Else
If duplicatesheet4.Range("Y11").Value <= duplicatesheet4.Range("Y16") Then
Call duplicatefindertransfer3
Call Assigned_duplicate
Last edited by a moderator: