I am trying to get the Order#(Cell A5) updated from the Pivot Table "Piv" in Column K. then Print two copies and continue doing so for every Order # present in the table.
-All of the other fields populate based off of the Order #.
I record a macro(In Green Below) to see what VBA would populate but I am having a hard time figuring out how to get VBA to look at the table and run no matter if there is 5 sets of data in the table or 50.
I am getting lost on how to get VBA to look at the cell's the "Piv" table is occupying and print dynamically based on the table.
Or would it be simpler to something like below in an "IF" function?
How could I tell VBA to keep going until is runs out of data without manually putting in all of the ranges?
Range("K3").Copy Range("A5")
ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True, IgnorePrintAreas:=False
Range("K4").Copy Range("A5")
ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True, IgnorePrintAreas:=False
Range("K5").Copy Range("A5")
Any help or a push in the right direction would be greatly appreciated.
Sub Macro4()
'
' Macro4 Macro
'
ActiveSheet.PivotTables("Piv").PivotSelect "'45812'", xlDataAndLabel _
+ xlFirstRow, True
Selection.Copy
Range("A5").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True, _
IgnorePrintAreas:=False
ActiveSheet.PivotTables("Piv").PivotSelect "'46017'", xlDataAndLabel _
+ xlFirstRow, True
Selection.Copy
Range("A5").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True, _
IgnorePrintAreas:=False
End Sub
-All of the other fields populate based off of the Order #.
I record a macro(In Green Below) to see what VBA would populate but I am having a hard time figuring out how to get VBA to look at the table and run no matter if there is 5 sets of data in the table or 50.
I am getting lost on how to get VBA to look at the cell's the "Piv" table is occupying and print dynamically based on the table.
Or would it be simpler to something like below in an "IF" function?
How could I tell VBA to keep going until is runs out of data without manually putting in all of the ranges?
Range("K3").Copy Range("A5")
ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True, IgnorePrintAreas:=False
Range("K4").Copy Range("A5")
ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True, IgnorePrintAreas:=False
Range("K5").Copy Range("A5")
Any help or a push in the right direction would be greatly appreciated.
Sub Macro4()
'
' Macro4 Macro
'
ActiveSheet.PivotTables("Piv").PivotSelect "'45812'", xlDataAndLabel _
+ xlFirstRow, True
Selection.Copy
Range("A5").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True, _
IgnorePrintAreas:=False
ActiveSheet.PivotTables("Piv").PivotSelect "'46017'", xlDataAndLabel _
+ xlFirstRow, True
Selection.Copy
Range("A5").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True, _
IgnorePrintAreas:=False
End Sub