VBA Loops / IF
This is likely to be really simple for many, but I can't seem to get my head around it. I have the below which works almost perfectly.
I basically have a list of 50 invoices in the A column and a invoice template on another sheet. The invoice template will pull the information for A2 so all the information is in the invoice, then save. As the information is pulled only from A2, I need to then delete that row so it picks up the next item in the list.
Currently, because im deleted a row it is skipping numbers, for example, if I had a list of 1-10 it would save, 1,3,5,7,9 and complete.
Any help or edits would be appreciated
Sub test()
For each x in range (“A2:A50”)
If x.value = “>1” then
Sheets("Template Re-design").Select
FileName = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 5)
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
"M:\2016\Collections AR\RESTORED\Invoices\" & Cells(1, 1).Value & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
Sheets("Addresses").Select
Rows("2:2").Select
Selection.Delete Shift:=xlUp
End if
Next x
End Sub
Bookmarks