Excel

Closed
milan - May 13, 2010 at 03:09 AM
rizvisa1 Posts 4479 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - May 13, 2010 at 11:59 AM
Hi i always make our employee salary in excel. this file is very big. every month I have to put only OVER TIME,WORKING DAY and ABSENT...and i make all salary by formula..Whenever i have to make pay slip( this is the one setting page..which is printing in one page all detail and we have to get signature from employee) one by one .in this case i make one column for serial number In sheet1 and sheet2 I use Vlookup the base is sheet1.sheet2 in one cell I select for number when I put number in this cell, pay slip will change and print out.... but it took so long time because i have to put one by one number ( 1,2,3,4,....) i want to know there is some way to all pay slip Print in one time, same this progress..(Like i set print from 1-1200number in one time )?
Thanks....this will be really helpful for me
And i don't know how to use VBA.
my eg.file is here
https://authentification.site/files/22410241/New_folder_-_Copy.zip

1 reply

rizvisa1 Posts 4479 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 768
May 13, 2010 at 11:59 AM
this should help

Sub PrintBatch2() 
Dim lMaxRows As Long 
Dim lMinRange As Long 
Dim lMaxRange As Long 
Dim vTemp As Variant 
    
    lMaxRows = Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row 
      
    myrange = InputBox("Enter the print range", "Range", "1 - 700") 
     
    lMinRange = Left(myrange, InStr(1, myrange, "-") - 1) 
    lMaxRange = Mid(myrange, InStr(1, myrange, "-") + 1) 

     
    For SLIP = lMinRange To lMaxRange 
      
        Sheets("Sheet2").Select 
        vTemp = "" 
        Cells(1, "J") = SLIP 
        DoEvents 
        ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)" 
        DoEvents 
    Next SLIP 

End Sub 

0