VBA Copy Paste Print Loop until empty

ChaserQwerty

New Member
Joined
Oct 4, 2017
Messages
7
Looking for VBA help to complete this task...

Goal is to copy and past from cells into a templet, print a defined area with this information then repeat until there is a blank cell.

The macro for doing 1 row of information looks like this...
How do I get the macro to loop until there is nothing in column A?



[TABLE="width: 776"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Row/Column[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C [/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]16[/TD]
[TD]MN[/TD]
[TD]SN[/TD]
[TD]Code-128 MN[/TD]
[TD]Code-128 SN[/TD]
[/TR]
[TR]
[TD]17[/TD]
[TD]H8251235T0B375[/TD]
[TD]123654789[/TD]
[TD]ÑHÌrS7Í5T0B3750Ó[/TD]
[TD]Ò,DVnÍ9mÓ[/TD]
[/TR]
[TR]
[TD]18[/TD]
[TD]H8251235T0B376[/TD]
[TD]123654789[/TD]
[TD]ÑHÌrS7Í5T0B376=Ó[/TD]
[TD]Ò,DVnÍ9mÓ[/TD]
[/TR]
[TR]
[TD]19[/TD]
[TD]H8251235T0B377[/TD]
[TD]123654789[/TD]
[TD]ÑHÌrS7Í5T0B377JÓ[/TD]
[TD]Ò,DVnÍ9mÓ[/TD]
[/TR]
</tbody>[/TABLE]




Sub Macro1()
' Macro1 Macro
Range("A17").Select
Selection.Copy
Range("A1:D2").Select
ActiveSheet.Paste
Range("B17").Select
Application.CutCopyMode = False
Selection.Copy
Range("A7:D8").Select
ActiveSheet.Paste
Range("C17").Select
Application.CutCopyMode = False
Selection.Copy
Range("A3:D4").Select
ActiveSheet.Paste
Range("D17").Select
Application.CutCopyMode = False
Selection.Copy
Range("A9:D10").Select
ActiveSheet.Paste
Range("A1:D10").Select
Application.CutCopyMode = False
ActiveSheet.PageSetup.PrintArea = "$A$1:$D$10"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
End Sub
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
How about
Code:
Sub Macro1()

   Dim Cnt As Long
      
   ActiveSheet.PageSetup.PrintArea = "$A$1:$D$10"

   For Cnt = 17 To Range("A" & Rows.Count).End(xlUp).Row
      Range("A" & Cnt).Copy Range("A1:D2")
      Range("B" & Cnt).Copy Range("A7:D8")
      Range("C" & Cnt).Copy Range("A3:D4")
      Range("D" & Cnt).Copy Range("A9:D10")
      ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
         IgnorePrintAreas:=False
      Range("A1:D10").ClearContents
   Next Cnt
End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top