Can somebody please assist me and seeing what I did wrong on the code below. I keep getting error Compile error: Next without For.
Sub createPDFfiles() Dim ws As Worksheet Dim Fname As String Dim i, j As Integer For Each ws In ActiveWorkbook.Worksheets On Error Resume Next For i = 1 To 20 j = 57
If (Cells(i, j)) = "1" Then Fname = "Annex 1.1." & ws.Index & "_result" ws.ExportAsFixedFormat _ Type:=xlTypePDF, _ Filename:=Fname, _ Quality:=xlQualityStandard, _ IncludeDocProperties:=True, _ IgnorePrintAreas:=False
Next
Else Next ws
End Sub 1 Answer
The {If, Else, End If} must be completely within the For loop.