Hi All,
I guess there were a thousand of threads like mine, but I couldn't find the specific case to my issue.
I've got Workbook with 2 Sheets: Source (with data) and Template (with tables and information to print).
I've recorded the first macro with copying data 4 times from one cell Source to another in Template, then print.
And now I'm trying to find the way to do this same but from next cell in Source into this same in the Template.
List of commands:
B2 -> C2:M3
F2 -> V2:AF3
K2 -> V4:AF5
O2 -> M8:R9
So after these commands Template will be printed and repeated with cells B3, F3... until the cells will be blank.
My VBA code looks bad, but I just started with VBA:
So for now, my macro is deleting the first row and repeating itself until will stop (but it crashing on the end) and looks very ugly.
Could you help me with this code to look more professional?
Thank you!
I guess there were a thousand of threads like mine, but I couldn't find the specific case to my issue.
I've got Workbook with 2 Sheets: Source (with data) and Template (with tables and information to print).
I've recorded the first macro with copying data 4 times from one cell Source to another in Template, then print.
And now I'm trying to find the way to do this same but from next cell in Source into this same in the Template.
List of commands:
B2 -> C2:M3
F2 -> V2:AF3
K2 -> V4:AF5
O2 -> M8:R9
So after these commands Template will be printed and repeated with cells B3, F3... until the cells will be blank.
My VBA code looks bad, but I just started with VBA:
Code:
Sub Macro3()
Do
If Worksheets("Source").Range("B2").Value > 0 Then
Sheets("Source").Select
Range("B2").Select
Selection.Copy
Sheets("Template").Select
Range("C2:M3").Select
ActiveSheet.Paste
Sheets("Source").Select
Range("F2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Template").Select
Range("V2:AF3").Select
ActiveSheet.Paste
Sheets("Source").Select
Range("K2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Template").Select
Range("V4:AF5").Select
ActiveSheet.Paste
Sheets("Source").Select
Range("O2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Template").Select
Range("M8:R9").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
Sheets("Source").Select
Range("A2").Select
Selection.EntireRow.Delete
Sheets("Template").Select
End If
Loop
End Sub
So for now, my macro is deleting the first row and repeating itself until will stop (but it crashing on the end) and looks very ugly.
Could you help me with this code to look more professional?
Thank you!