How to Move to Next Row, start over, unless blank

AlpineB

New Member
Joined
Feb 19, 2019
Messages
1
Hi,

I've written a macro to take an employee database Sheets("CEP Program"); copy a row representing a single employee & their information to a source sheets("Source Data") and then use the values in Source Data to fill a form in Sheets("Verification Sheet"), and print the Verification sheet form. Now I need it to repeat for each employee AKA each row, and stop after the last row. I've tried to cobble together how to make this happen, but I'm not making much progress. Can you help me edit this code?


Sub CEP_VerificationFillPrint()
'
' CEP_VerificationFillPrint Macro
'
' Keyboard Shortcut: Ctrl+y
For Each Row In ActiveSheet
ActiveWindow.SmallScroll Down:=-18
EntireRow.Select
Selection.Copy
Sheets("Source Data").Select
Range("A2").Select
ActiveSheet.Paste
Sheets("Verification Sheet").Select
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
Sheets("CEP PROGRAM").Select
Next Row

End Sub
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
try this

VBA Code:
Sub CEP_VerificationFillPrin2t()
'
' CEP_VerificationFillPrint Macro
'
' Keyboard Shortcut: Ctrl+y

    For Each Rw In Sheets("CEP PROGRAM").Range("A2", Sheets("CEP PROGRAM").Cells(Rows.Count, 1).End(xlup))
        Rw.Copy Sheets("Source Data").Range("A2")
        Sheets("Verification Sheet").PrintOut Copies:=1, Collate:=True, _
        IgnorePrintAreas:=False
    Next Rw
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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