Hello,
Hoping someone could help?
I'm just getting back into VBA and although I've managed to get quite far, I'm drawing a mind blank getting the end at variable table length.
I have a table (called "Mass_Doc_Run") where the length can be variable Sheets("Mass Doc Run"), columns A, B and C have data which is copy pasted into another sheet. There is then a corresponding IF statement depending upon the answer given within a cell to create a PDF and save down.
Can someone help with repeating the above until the table "Mass_Doc_Run" ends? This is variable length which is the bit which is causing me a problem.
Hope this makes sense - first time using a forum!
Thanks,
Alex
Hoping someone could help?
I'm just getting back into VBA and although I've managed to get quite far, I'm drawing a mind blank getting the end at variable table length.
I have a table (called "Mass_Doc_Run") where the length can be variable Sheets("Mass Doc Run"), columns A, B and C have data which is copy pasted into another sheet. There is then a corresponding IF statement depending upon the answer given within a cell to create a PDF and save down.
Can someone help with repeating the above until the table "Mass_Doc_Run" ends? This is variable length which is the bit which is causing me a problem.
Hope this makes sense - first time using a forum!
Thanks,
Alex
VBA Code:
Sub TEST()
Sheets("Mass Doc Run").Select
Range("A2").Select
Selection.Copy
Sheets("Template Control").Select
Range("B6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Mass Doc Run").Select
Range("B2").Select
Selection.Copy
Sheets("Template Control").Select
Range("B8").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Mass Doc Run").Select
Range("C2").Select
Selection.Copy
Sheets("Template Control").Select
Range("B9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
If Sheets("Template Control").Range("B9").Value = "POC" Then
Sheets("Proof of Compliance (POC)").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
Sheets("Template Control").Range("B1").Text, Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
ElseIf Sheets("Template Control").Range("B9").Value = "POS" Then
Sheets("Proof of Sustainability (POS)").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
Sheets("Template Control").Range("B1").Text, Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
End If
End Sub