Code:
For i = 1 To 14
Today = Worksheets("Impending Orders").Range("B3").Value
ConvertDate = Right(Today, 2) & Mid(Today, 4, 2) & Left(Today, 2)
FilePath = Worksheets("Impending Orders").Range("B1").Value
backdate = (Right(ConvertDate, 2) - i)
If Len(backdate) = 1 Then
backdate = "0" & backdate
Else
End If
filedate = Right(Today, 2) & Mid(Today, 4, 2) & backdate
sheetdate = Mid(filedate, 3, 2) & "/" & Mid(filedate, 5, 2) & "/20" & Left(filedate, 2)
FullFileName = GetFullFileName(FilePath, filedate)
Set OrderSource = Workbooks.Open(FilePath & FullFileName)
If OrderSource <> "" Then
OpenMostRecentOrders = True
Exit Function
Else
Next i 'the problem is this next
End If
You can ignore the substance of the code as this is just a syntax problem (Compile error).
I can't get my head around where my syntax is wrong here. It clearly says 'For' at the top, yet Excel keeps returning 'Next Without For'. Can anyone see what I evidently can't?