Hi,
I have some code below where H8 is an invoice number which I will start at the number 4000. Cell Z1 is a customer name.
I then want to run this code until all invoices are ran up to number 4300. So in essences running this piece of code 300 times with Invoice 4000 being the first one, 4001 the second and so on. Could someone advise please and what i need to add 1 to change cell H8 after each time the code is run and then run the code again. I am guessing its Do until but not sure how to implement, TIA
I have some code below where H8 is an invoice number which I will start at the number 4000. Cell Z1 is a customer name.
I then want to run this code until all invoices are ran up to number 4300. So in essences running this piece of code 300 times with Invoice 4000 being the first one, 4001 the second and so on. Could someone advise please and what i need to add 1 to change cell H8 after each time the code is run and then run the code again. I am guessing its Do until but not sure how to implement, TIA
VBA Code:
Sub saveinvoice()
Call hide
v = "Invoice " & ActiveSheet.Range("H8") & "-" & ActiveSheet.Range("Z1") & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"Invoice " & ActiveSheet.Range("H8") & "-" & ActiveSheet.Range("Z1") & ".pdf", Quality _
:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Range("B1:I204").Select
ActiveSheet.PageSetup.PrintArea = "$B$1:$I$204"
With ActiveSheet
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=v, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, From:=1, To:=16, OpenAfterPublish:=False
End With
Call unhide
End Sub