Hello,
I have the following but of VBA code as a loop. For each loop (from rows 2 to 50) I want it to check whether the value in column U is 0 and if it is to just move straight to the next row/loop... if the data is not 0 I want it to run the rest of the code. However, it runs through 2 loops (the first has 0 in column U, the second doesn't) and then just stops... so I think I have something the wrong way round?
Sheets("Info").Select
For x = 2 To 50
If Range("U" & x).Value = 0 Then
Else
Sheets("Info").Select
C = Range("B" & x).Value
D = Range("M" & x).Value
Sheets("DATA").Select
Selection.AutoFilter Field:=18, Criteria1:=C
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False
Columns("R:R").Select
Selection.Delete Shift:=xlToLeft
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
D, FileFormat:= _
xlOpenXMLWorkbook, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
Application.DisplayAlerts = True
ActiveWindow.Close
Windows("Bulk Upload File.xlsm").Activate
End If
Next x
End Sub
Bookmarks