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

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
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,224,820
Messages
6,181,162
Members
453,021
Latest member
Justyna P

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