I have the following code which searches for the different available products using the sequence of numbers.
If one product number is missing this code throws an error message.
Example of my code:-
Sub mycode()
icnt1 = 0
max1 = Range("N1").Value
For store = 1 To max1
icnt1 = icnt1 + 1
Windows(File6).Activate
ActiveSheet.Range("$A$1:$K$10000").AutoFilter Field:=1, Criteria1:=icnt1
Range("H2", Range("H" & Rows.Count).End(xlUp)).Select
Selection.Copy
Sheets("template").Copy Before:=Sheets("template")
ActiveSheet.Name = "s" & icnt1
Sheets("s" & icnt1).Select
Range("T3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Next
End Sub
If I have a product list in accurate sequence (1, 2, 3, 4, 5 etc.) then I am not facing any issue.
If one or more products is missing (like 1, 2, 4, 5, 6 etc.) I am getting an error message. I tried to put an option of On Error Resume Next
but that is also not working.