+ Reply to Thread
Results 1 to 3 of 3

Need Help generate the payslip each emploe separate PDF files

  1. #1
    Registered User
    Join Date
    07-24-2014
    Location
    hyd
    MS-Off Ver
    2010
    Posts
    13

    Need Help generate the payslip each emploe separate PDF files

    I have Code I need to generate all employees separates PDF files Can you help me plzzzzzz

    {Sub Generate_Salary_Slip()
    Dim ws1 As Worksheet: Set ws1 = Sheets("Salary Calculation")
    Dim wsTemp As Worksheet: Set wsTemp = Sheets("Pay Slip")
    Dim wsEE As Worksheet
    Dim rCell As Range

    Application.ScreenUpdating = False

    For Each rCell In ws1.Range("B2:B" & ws1.Range("B" & Rows.Count).End(xlUp).Row)
    If rCell.Value <> "" Then
    'check for existing worksheets and create new one for each employee
    Set wsEE = Nothing
    On Error Resume Next
    Set wsEE = Sheets(rCell.Value)
    If wsEE Is Nothing Then
    wsTemp.Copy After:=Sheets(Sheets.Count)
    Set wsEE = Sheets(Sheets.Count)
    wsEE.Name = rCell.Value
    Else
    Application.DisplayAlerts = False
    wsEE.Delete
    Application.DisplayAlerts = True
    End If
    On Error GoTo 0

    'popuate data on employee sheet
    With wsEE
    .Range("B3").Value = ws1.Range("B" & rCell.Row).Value
    '.Range("F10").Value = ws1.Range("F" & rCell.Row).Value
    .Range("B4").Value = ws1.Range("C" & rCell.Row).Value
    .Range("B5").Value = ws1.Range("D" & rCell.Row).Value
    .Range("B6").Value = ws1.Range("E" & rCell.Row).Value
    .Range("B7").Value = ws1.Range("F" & rCell.Row).Value
    .Range("B8").Value = ws1.Range("N" & rCell.Row).Value
    .Range("B11").Value = ws1.Range("Q" & rCell.Row).Value
    .Range("B12").Value = ws1.Range("R" & rCell.Row).Value
    .Range("B13").Value = ws1.Range("S" & rCell.Row).Value
    .Range("B14").Value = ws1.Range("T" & rCell.Row).Value
    .Range("B15").Value = ws1.Range("U" & rCell.Row).Value
    .Range("B16").Value = ws1.Range("AA" & rCell.Row).Value
    .Range("B17").Value = ws1.Range("AC" & rCell.Row).Value
    .Range("D8").Value = ws1.Range("O" & rCell.Row).Value
    .Range("D11").Value = ws1.Range("T" & rCell.Row).Value
    .Range("F3").Value = ws1.Range("H" & rCell.Row).Value
    .Range("F4").Value = ws1.Range("I" & rCell.Row).Value
    .Range("F5").Value = ws1.Range("J" & rCell.Row).Value
    .Range("F6").Value = ws1.Range("K" & rCell.Row).Value
    .Range("F7").Value = ws1.Range("L" & rCell.Row).Value
    .Range("G11").Value = ws1.Range("V" & rCell.Row).Value
    .Range("G12").Value = ws1.Range("W" & rCell.Row).Value
    .Range("G13").Value = ws1.Range("X" & rCell.Row).Value
    .Range("G14").Value = ws1.Range("Y" & rCell.Row).Value
    .Range("G15").Value = ws1.Range("Z" & rCell.Row).Value
    .Range("G16").Value = ws1.Range("AB" & rCell.Row).Value
    ' .Range("B9").Value = ws1.Range("Z" & rCell.Row).Value
    '.Range("D5").Value = ws1.Range("AA" & rCell.Row).Value
    '.Range("B7").Value = ws1.Range("E" & rCell.Row).Value
    '.Range("D7").Value = ws1.Range("AC" & rCell.Row).Value
    '.Range("D6").Value = ws1.Range("AD" & rCell.Row).Value
    '.Range("B6").Value = ws1.Range("AE" & rCell.Row).Value
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    '
    'follow the same format in the 2 lines above to populate the employee sheet
    '
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    End With
    End If
    Next rCell

    Application.ScreenUpdating = True

    End Sub
    }

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Need Help generate the payslip each emploe separate PDF files

    Record a macro of you saving one as a PDF, then modify that code.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    07-24-2014
    Location
    hyd
    MS-Off Ver
    2010
    Posts
    13

    Re: Need Help generate the payslip each emploe separate PDF files

    Thanks for reply Nathansav . I am tray the macro record but unable to create the Pdfs . Can you please resolve me its urgent.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to generate payslip and print it all at once
    By macnabong in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-10-2014, 02:36 AM
  2. [SOLVED] HOW to prepare payroll in macros and generate payslip in EXCEL 2003
    By sysen_aee in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-21-2014, 06:39 AM
  3. [SOLVED] Generate a payslip in Excel with info provided.
    By Manuel Pedro in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-23-2013, 09:26 AM
  4. VBa: To generate PAYSLIP
    By flopoguns in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-19-2013, 03:49 PM
  5. Replies: 2
    Last Post: 04-04-2013, 07:27 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1