General discussion

Locked

payroll spreadsheet, loop to print stubs

By Robert Burge ·
Help needed with inserting a print command in a loop to print a pay stub if another employee exists in the register portion of the worksheet. I have the stub set as the print area, and need this to print for each employee.

Thanks in advance

Robert Burge
North Atlantic Petroleum
St. John's, NF

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

payroll spreadsheet, loop to print stubs

by DKlippert In reply to payroll spreadsheet, loop ...

Have you though about setting up the paystub form in Word and then doing a Mail Merge?
You could still do queries to print stubs that fit a particular criteria, and the stubs could be formatted more easily.

Collapse -

payroll spreadsheet, loop to print stubs

by Robert Burge In reply to payroll spreadsheet, loop ...

It's not a formatting issue, all I want is to print multiple stubs within a loop if more than one record exists.

Collapse -

payroll spreadsheet, loop to print stubs

by srobertson In reply to payroll spreadsheet, loop ...

You could try using a "For Each" Loop using your register list as the range. For Example:- (Assumes register list range is in Column B with a header at "B1")

Sub Print_Loop ()

'Variable Declaration
Dim TestCell as Range

'Find End Of List
Range("B1").Select

If Activecell.Offset <> "" then
Selection.End(xlDown).Select
Else
Activecell.Offset (1,0).Select
End If

'Loop for each value in the Test Range
For Each TestCell in Range("B2:B" & Activecell.Row)

'Set changing Register Variable
Range("RegisterVariable").Value = TestCell.Value

'Print Register Stub Sheet
Sheets("PayRollStub").PrintOut

Next TestCell

End Sub

You haven't provided a lot of information to go on so I hope this is sort of what your'e looking for.

Scott.

Collapse -

payroll spreadsheet, loop to print stubs

by srobertson In reply to payroll spreadsheet, loop ...

Sorry,

The line 'If Activecell.Offset <> "" then' should read

'If Activecell.Offset(0,1).Value <> "" then'

Scott.

Collapse -

payroll spreadsheet, loop to print stubs

by Robert Burge In reply to payroll spreadsheet, loop ...

Please email again, it actually did help, but I want to ask you another question.

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums