How to Restart Loop from begining when If statement is true? I am running a macro using a list of values in column A and using For and Next i to restart and loop through my data until the end of the list of data is reached.During the loop, I have If statements researching each value and if it equals a certain value then i need it to complete that loop and start the Next i over again.If A2 = 1 then process one way and restart loop with next data point (A3)If A2 = 2 then process a different way and restart loop with next data point (A3)If A2 = anything else, process a different ay and restart loop with next data point (A3)
Please do not focus on the actions that each statement is making, but only on how i can restart at the top with the Next i when the IF statement is true.
Thank you in advance.Jeff
Code:
________________________________________Dim i As Integer For i = 2 To Range("A" & Rows.Count).End(xlUp).Row Range("A" & i).Select If Selection.Value = 1 then msgbox "HI" ' ***I need something that when value = 1 it finds the next data point (Next i) and doesn't finish checking the rest of the below If Statements End If Selection.copy Range("B1").Select ActiveCell.End(xlDown).Select ActiveCell.Offset(1, 0).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False If Selection.Value = 2 then Msgbox "Hello" ' ***I need something that when value = 1 it finds the next i here and not finishing the rest of the if statements for this selection value. Else Selection.copy Range("C1").Select ActiveCell.End(xlDown).Select ActiveCell.Offset(1, 0).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False If Selection.Value = 2 then End If Next iEnd Sub ________________________________________
