+ Reply to Thread
Results 1 to 5 of 5

Run calculations in template for 1 person, copy-paste results, repeat for next person

  1. #1
    Forum Contributor
    Join Date
    04-30-2014
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2010
    Posts
    113

    Run calculations in template for 1 person, copy-paste results, repeat for next person

    Hi everyone,

    I'm hoping to get some help with some VBA code. I've starting writing parts of it but I'm not sure how to continue. I've attached a sample file.

    What code can I use to copy-paste a name (any name except names that start with "ICMTR") from a pivot table in ref!A2: (variable) to a cell (temp!v1), let excel calculate the formulae in the 'temp' worksheet (temp!A2:S53), copy-paste those rows for which sumif(temp!D:Q, ">"$0) to the next blank row in 'data' worksheet. Then repeat for the next name in the pivot table until the last name.

    FILE: forum-summarize data.xlsx

    I've started with the following but then I got stuck:
    Please Login or Register  to view this content.
    Thanks a lot for any help you can give me!

    Geoff.
    Last edited by Geoff.; 10-29-2014 at 12:59 PM.

  2. #2
    Forum Contributor
    Join Date
    04-30-2014
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Run calculations in template for 1 person, copy-paste results, repeat for next person

    I thought I would add some information in case the way I am trying to do this is not the best and you can think of a more efficient way to achieve the same results.

    Here is a description of each of the worksheets:

    'raw' worksheet:
    The 'raw' worksheet is where I paste a set of data. The data is pasted in raw!A1, has 11 columns and a varying amount of rows (a few hundred to several thousands). With a date range that can span a few weeks to a few months.

    'temp' worksheet:
    The 'temp' worksheet is a template of the operations used to summarize the data in the 'raw' worksheet for a single employee by week (it contains formulas that process the data in the 'raw' worksheet) (it contains 52 weeks for the max data available for an employee in a year).

    'ref' worksheet:
    The 'ref' worksheet mainly contains a pivot table that lists the unique names of employees found in the raw data worksheet (raw!E:E).

    'data' worksheet:
    This is where I particularly need some help. This 'data' worksheet is where the data from each unique name is compiled (added one below the other). Each employee has as many rows as weeks for which there is data for them.

    I would like to run the formulas in the 'temp' worksheet for each employee listed in the pivot table found in the 'ref' worksheet (expect for the names which begin with "ICMTR"). The way I am trying to do this part means that I have to paste each name in temp!V1, have excel calculate the sheet, and copy the rows (in 'temp' and only those rows where columns D to Q sum up to greater than zero) to the next available row in the 'data' worksheet. Repeat until the employee listed in the pivot table is done.

    Hope this is clear and it helps you help me!

    Cheers,

    Goeff.
    Last edited by Geoff.; 10-29-2014 at 01:28 PM.

  3. #3
    Forum Contributor
    Join Date
    04-30-2014
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Run calculations in template for 1 person, copy-paste results, repeat for next person

    I've been trying to piece together all the parts of the code that I need and I've gotten much further but I could still use some help if any of you are able to (I'm not sure if it's a good idea to keep adding new posts to this thread but I will add this last bit showing the progress I've made and see if anyone can help from this point).

    The following code tries to cover all three major actions that I need:

    1)
    'looks for the next employee name in the 'ref' worksheet
    'and then copies this name in the 'temp' worksheet
    'and then calculate the worksheet

    2)
    'looks for rows in 'temp' that contain data and copies this row to the next available row in the 'data' worksheet

    3)
    'loop number 1 above and, within this loop, loop number 2 above ( I am not sure how to put one loop within another)

    The code:
    Please Login or Register  to view this content.
    Last edited by Geoff.; 10-30-2014 at 03:14 PM. Reason: found an error in code

  4. #4
    Forum Contributor
    Join Date
    04-30-2014
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Run calculations in template for 1 person, copy-paste results, repeat for next person

    Hmm, maybe this is too much to ask, maybe I will try to get help on one section at a time instead..

    Thanks for having a look though,

    Goeff.

  5. #5
    Forum Contributor
    Join Date
    04-30-2014
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Run calculations in template for 1 person, copy-paste results, repeat for next person

    Hey Everyone,

    In case anyone is trying to do something similar, it looks like I may have figured it out. Here is the code:

    Please Login or Register  to view this content.
    Cheers,

    Goeff.
    Last edited by Geoff.; 11-25-2014 at 06:06 PM. Reason: Had submitted wrong code

+ 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. VBA to convert person-to-event into person-person
    By LuckyStrike in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-07-2014, 02:34 PM
  2. A way to send file to certain person, depending on person saving?
    By shiftyspina in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-12-2014, 12:13 PM
  3. Transpose/Pivot multiple rows per person into 1 row per person with fixed columns
    By MaestroEnrique in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-13-2013, 06:35 AM
  4. same person, different dates...need the latest date from every person
    By Tanisman in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-26-2011, 07:16 AM
  5. Replies: 3
    Last Post: 02-27-2007, 05: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