+ Reply to Thread
Results 1 to 17 of 17

Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    05-12-2012
    Location
    India, Chennai
    MS-Off Ver
    Excel 2003
    Posts
    182

    Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

    Hi Expert RVASQUEZ

    Please see the attachment.

    An auto generated Excel Sheet is Generated from our Timer machine on every 1st to 15th and 16th to 31st which has minimum data. (July2012P2.xls)

    Using that data

    I have created sample sheet using formulas for calculating more information

    What I request:
    Step 1 : On click of button from this workbook(AB.xlsm) , auto calculate information in "july2012P2_sample.xls" and then copy that data to related month / Part/ Emp code / Days . Same action for each Employee

    Some of fixed data is to be collected from this WB Sheet : Master for calculating
    Regular Shift Hours
    Fixed Commission /Hourly/ Minute for Each Employee
    Fixed B reak Time

    Step2 :

    On related Month (Sheet: Jul2 ) the extracted data is collected from Jul2012P2.xls

    Step3:
    From that data the final pay calculation to be arrived as given in Sheet - Jul2(top)

    Hope i have not confused Please take a look at the attachment
    Attached Files Attached Files
    Last edited by skhari; 07-23-2012 at 07:38 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

    I'm sorry, I'm a little confused as to what you are trying to do. Could you please reload sample workbooks with the correct names that you've used above? You are referencing workbook ending in P2 and none of your workbooks loaded have that name. Also, in your workbook could you do two worksheets, one what it looks like before the macro and the other a copy of the worksheet, updated to mock what you would like it to look like after the macro.

    Thank you,

    RVASQUEZ

  3. #3
    Forum Contributor
    Join Date
    05-12-2012
    Location
    India, Chennai
    MS-Off Ver
    Excel 2003
    Posts
    182

    Re: Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

    P2 = Part 2 (16 to 31st) which is July2012P2.xls

    I have uploaded the correct file (july2012P2.xls) which has sample data.
    I will receive a data loaded file named july2012P2.xls with the data from A : R, then
    Step 1 : With the help of vba/macro formula i need get the result from S:Z
    Step 2 : Get this result to AB.xlsm WorkSheet : Jul_P2 (to Row 25 to till down) Consolidated Name & Code wise
    Step 3 : From that consolidated result i need to get total R Hrs, Extra Hrs, Total Pay for a particular employee from (16 to 31st July)

    Thank you so much for your time

    SK
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

    Yes, your reply was clear, thank you. Could you please tell me if you run two reports or just one? I noticed you have a 1st through 15th and then a 16th through 31st. Do these reports appear on the same page or are they run at two seperate times?

    Also, will employees always appear in each week even if they didn't work a date? For instance if George works on the 16th and does not work on the 17th would he still appear in the report on the 17th just with no time in or out?

    As always, please keep in mind I do this when I am not assigned anything at work so please be patient.


    Thanks!
    Last edited by rvasquez; 07-24-2012 at 11:58 AM.

  5. #5
    Forum Contributor
    Join Date
    05-12-2012
    Location
    India, Chennai
    MS-Off Ver
    Excel 2003
    Posts
    182

    Re: Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

    1. Its TWO reports, They run at two separate times 1-15 (MonthYearP1.xls) and 16-31(MonthYearP2.xls)
    2. Yes, George will still appear on 17th with no in/out time.

    Yes I understood your effort. Please take a your time. And Sorry if my message urged you.

    Thanks a lot...
    Last edited by skhari; 07-24-2012 at 12:26 PM.

  6. #6
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

    Hey there,

    Okay I've got the code done for you just a couple of questions before I hand it over.

    1. Will the worksheet for the report always be named ComPayPunch?
    2. Will the code need to add the Worksheets (i.e. Jul_P1) to the AB workbook or will they have already been created?

    Thanks!
    Last edited by rvasquez; 07-27-2012 at 10:19 AM.

  7. #7
    Forum Contributor
    Join Date
    05-12-2012
    Location
    India, Chennai
    MS-Off Ver
    Excel 2003
    Posts
    182

    Re: Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

    oh.. excited

    1. YES - Worksheet always named ComPayPunch
    2. If i understood your question, Already sheets must be created from Jan to Dec each sheet will have a button to get the result for that particular period. Please revise your question if my answer is not relevant.

    Thanks for your effort

    SK

  8. #8
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

    Okay so this is what I have so far. Can you take a look read through it and let me know if it will work?

    When you open the workbook, enable macros and also Press Atl+F8 and select the copyToAB macro and select Step Into. There is a comment that states PLEASE NOTE. Please change the filepath before attempting to run the code as it will not work on your computer as is.

    Right now the macro formats the data in the July2012P2_Sample.

    It begins by performing step one, you requested. It then copies the comPayPunch worksheet to the end of the workbook. It then proceeds to format the data so that it look like you had defined in Step2.
    Next it copies the formatted data on the inserted worksheet, opens the AB workbook and looks for the month and either the first or Second run depending on the date. It then pastes the copied data to row 25 and begin step 3 of assigning formulas to row 4 through 24.

    Finally it closes the AB workbook, deletes the inserted worksheet from the Sample workbook and ends.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    05-12-2012
    Location
    India, Chennai
    MS-Off Ver
    Excel 2003
    Posts
    182

    Re: Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

    Hi rvasquez,

    As guided I have changed the file path. and clicked the button at Jul2012P2_Sample(1).xlsm
    and studied the action.

    All the calculation is great effort and thanks a lot.

    It works Great, But completely reverse. Im worried that my explanation is not good.

    An auto generated file will not have this type of genius coding inside. May be we have to take this coding to AB.xlsm

    ---
    Step 0 :
    a : Assuming that we have a auto generated set of excel file named already like Jul2012P1.xls, Jul2012P2.xls, Jun2012P1.xls, Jun2012P2.xls, Feb2012P1.xls ... so on, upcoming month will auto generate from the timer machine to this folder - All files will have only data up to (A : P)
    Coding cannot be inserted each time by the users. So... We have to Make AB.xlsm is the Main File with the coding.

    b: AB.xlsm : will contain WorkSheet (WS) Start Page, Master, Jan_P1, Jan_P2, Feb_P1, Feb_P2,........., Jul_P1, Jul_P2......, Dec_P1, Dec_P2
    AB.xlsm will also contain all the necessary coding to get the result from the relevant month (stated below Note1)

    Inside the month WS:Jul_P1,
    - Pre-filled data will be occupied from A2: Z23(Employee Name , Code, No of Days Present, Total R Hrs, Extra Hrs, Total Pay )
    - Save Button - For saving the current period into new workbook with the same name has the work sheet name

    Main file is AB.xlsm, from here the users clicks the button and then the action takes process

    Step 1 :
    1. We first open the Main file "AB.xlsm" > Start Page >
    2. Selecting the period(Note1) It will give, from which file we have to get the data.

    Note1:
    User selects the file to pick the result WB: AB.xlsm > WS: Start Page > (A2) YEAR , (B2) Month (B2), and (C2) Part = (E2) eg: C:/......Jul2012P2.xls(m)

    3. Then we should have a button on the Start Page which will Trigger the action > Open the exact file
    4. Calculation takes place (which is happening now)

    Step 2
    1. Receive that calculated data and consolidate them into AB.xlsm > Relevant Month eg: WS(Jul2012_P2)> to A25 to Till required

    Step 3
    1. Finally the required result we be collected to top pre-fixed table(A2:Z23) with respect of each employee wise.
    2. Clicking the Save Button will leads to save the particular sheet for future reference.

    Sorry if I am again confusing, If you want i can explain more...

    Thank you so much


    note2: While calculating, some data are "######" how to avoid this. ?!

  10. #10
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

    Okay just so I make sure I understand. What I gave you looks fine, you just need it to do it starting from AB?

  11. #11
    Forum Contributor
    Join Date
    05-12-2012
    Location
    India, Chennai
    MS-Off Ver
    Excel 2003
    Posts
    182

    Re: Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

    Yes

    Thank you!

  12. #12
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

    Alrighty, lets try this one. This one the user selects the year, month and part on the worksheet StartPage in the workbook AB. Then the user selects the Run Report button. This button will open up the workbook whose filepath is located in cell E5 of the worksheet StartPage. (You'll need to change the beginning of the filepath to your filepath again) It then formats the opened workbook and copies the information to the appropriate than in the AB worksheet. The macro then closes the opened workbook without saving changes. Finally, as requested, the code changes any negative numbers that are shown as ###### to 0 and returns to the StartPage worksheet and provides the user with a message box that the data has been imported and the worksheet it was imported to.

    Let me know if this works!

    Thanks!
    Attached Files Attached Files

  13. #13
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

    Hello there,

    I'm not sure if this accomplished what you were trying to do but it's been awhile so I'm going to unsubscribe from the thread. If you need furher assistance feel free to inbox me with a link to this thread.

    Thanks!

  14. #14
    Forum Contributor
    Join Date
    05-12-2012
    Location
    India, Chennai
    MS-Off Ver
    Excel 2003
    Posts
    182

    Re: Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

    Hi rvasquez,

    No Doubt It accomplished its task. Like a magic
    I am just waiting for you to come online
    To Say THANKS A LOT for this brilliant coding. It really took me a day to review this expert coding. Amazing!
    I am very happy.

    I have a small additional request to finish it up.

    Eg: Jul month part2

    1. When calculation is finished, While closing the file(Jul2012P2.xls)
    a. Get the data from AB.xls > Jul2012P2 (Work Sheet) to Jul2012P2.xls as a new sheet next to WS:Compaypunch
    b. Save the both (AB.xlsm and Jul2012P2.xls) calculated data file for future reference.

    2. If possible, to display Emp Code wise instead of Employee Alphabetical.


    Thanks for your humble words. Even if I am late to respond.
    Last edited by skhari; 08-01-2012 at 09:06 AM.

  15. #15
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

    Alrighty, in order for the code to copy the wbAB worksheet into the wbMonth workbook you'll need to save the wbMonth workbook as a xlsm file. The code does not automatically do this for you so you will need to do this before running the code. Then you can use the attached workbook AB with an updated code.

    Please note:

    The file path extension in cell E5 has changed from .xls to .xlsm

    Thanks!
    Attached Files Attached Files

  16. #16
    Forum Contributor
    Join Date
    05-12-2012
    Location
    India, Chennai
    MS-Off Ver
    Excel 2003
    Posts
    182

    Re: Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

    Yes! that was perfect has planned.

    1. Can we also keep the calculation happened in ws ComPayPunch
    2. Is it possible of displaying Emp Code wise? instead of alphabetical order.

    Thank you so much.

  17. #17
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Collecting Data from one WB to another WB and then Final values arriving - Time & Pay

    Hello there,

    As much as I love to help you I would also like if you could attempt to alter the code yourself.

    For Step 1.

    You can remove 3 lines of code from the copyToMONTH macro to get these results

    For Step 2.

    In the macro CopyOriginalDataToNewWs find the part of the macro that sorts the selection. And instead of sorting Key1 by .columns(3) sort by .columns(2)

    Let me know if you can't adjust the code by yourself and I'll help but I think it's good for you to learn how to read the code just in case problems arise in the future as not everyone has the same thought process when writing code.

    Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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