General discussion

  • Creator
    Topic
  • #2091346

    payroll spreadsheet, loop to print stubs

    Locked

    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

All Comments

  • Author
    Replies
    • #3880049

      payroll spreadsheet, loop to print stubs

      by dklippert ·

      In reply to payroll spreadsheet, loop to print stubs

      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.

    • #3831423

      payroll spreadsheet, loop to print stubs

      by srobertson ·

      In reply to payroll spreadsheet, loop to print stubs

      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.

Viewing 1 reply thread