Hi,
I know this is probably a FAQ, and for that I apologize. I did Google extensively before posting, but couldn't find exactly what I was looking for. If the code is somewhere I couldn't find, please just point me in the right direction. Thanks...
There are two potential business scenarios:
1) We have a single workbook with multiple worksheets. Worksheet1 is the "Master" worksheet. Worksheets2 - N are one per end user, say named by their LAN userid (the name isn't really relevant). Each end user will input his/her data into "their" worksheet. All worksheets except master will have the same structure: row 1 has column names, rows 2+ will contain data, column names and positions are identical across worksheets. This workbook will be shared for concurrent editing, with history turned off to reduce/eliminate workbook bloating.
The master worksheet will have a button to "Refresh Data". This will invoke a VBA macro to spin through worksheets 2 - N, copying the "active data" (i.e. cells actually containing something) in each workbook, concatenating the data into the master worksheet.
In pseudocode:
* get number of worksheets
* loop over worksheet2 - worksheetN
* activate A2
* search to last cell
* copy this range
* back to master worksheet
* activate A2 (for initial paste only)
* paste
* advance one row (so now in A#)
* rinse and repeat
The end result would be as if I'd selected each worksheet, copied the active data, and pasted into the master workbook, one after the other, with no blank lines between each paste.
2) Virtually identical to above, but each user's data is in a separate workbook, with only a single worksheet. Otherwise, identical processing as above. I'm happy if the master workbook and end user workbooks are in different directories, and the end user directory can only contain the relevant workbooks. If we want to implement a particular concatenation order, I'm happy to require that the workbooks have a file naming prefix, i.e. 01_userA.xlsx, 02_userB.xlsx, etc.
In pseudocode:
* get list of all workbooks (*.xls, *.xlsx, etc) in the end user directory.
* loop over each workbook
* process sheet1 in each workbook
* (then same processing as above)
My preference is scenario #1, but this is still being debated.
The actual business scenario is a very crude project management application (don't ask). So, each user inputs what they worked on each week: date, task, hours consumed, etc. The big manager then gets the concatenated data from the worker bees. I know there are numerous ways to do this better (JIRA, web tools, etc), but this is what they want.
Last nice to have: if we can filter the concatenated data, that would be super. So, spin through the end user worksheets, get only rows where date is between 22Jul13 and 28Jul13, and only concatenate that data. The manager would specify the start and end date in a couple of cells in the master workbook.
But at this point I'm happy for just a simple concatenation macro to get me started.
Thanks,
Scott
I know this is probably a FAQ, and for that I apologize. I did Google extensively before posting, but couldn't find exactly what I was looking for. If the code is somewhere I couldn't find, please just point me in the right direction. Thanks...
There are two potential business scenarios:
1) We have a single workbook with multiple worksheets. Worksheet1 is the "Master" worksheet. Worksheets2 - N are one per end user, say named by their LAN userid (the name isn't really relevant). Each end user will input his/her data into "their" worksheet. All worksheets except master will have the same structure: row 1 has column names, rows 2+ will contain data, column names and positions are identical across worksheets. This workbook will be shared for concurrent editing, with history turned off to reduce/eliminate workbook bloating.
The master worksheet will have a button to "Refresh Data". This will invoke a VBA macro to spin through worksheets 2 - N, copying the "active data" (i.e. cells actually containing something) in each workbook, concatenating the data into the master worksheet.
In pseudocode:
* get number of worksheets
* loop over worksheet2 - worksheetN
* activate A2
* search to last cell
* copy this range
* back to master worksheet
* activate A2 (for initial paste only)
* paste
* advance one row (so now in A#)
* rinse and repeat
The end result would be as if I'd selected each worksheet, copied the active data, and pasted into the master workbook, one after the other, with no blank lines between each paste.
2) Virtually identical to above, but each user's data is in a separate workbook, with only a single worksheet. Otherwise, identical processing as above. I'm happy if the master workbook and end user workbooks are in different directories, and the end user directory can only contain the relevant workbooks. If we want to implement a particular concatenation order, I'm happy to require that the workbooks have a file naming prefix, i.e. 01_userA.xlsx, 02_userB.xlsx, etc.
In pseudocode:
* get list of all workbooks (*.xls, *.xlsx, etc) in the end user directory.
* loop over each workbook
* process sheet1 in each workbook
* (then same processing as above)
My preference is scenario #1, but this is still being debated.
The actual business scenario is a very crude project management application (don't ask). So, each user inputs what they worked on each week: date, task, hours consumed, etc. The big manager then gets the concatenated data from the worker bees. I know there are numerous ways to do this better (JIRA, web tools, etc), but this is what they want.
Last nice to have: if we can filter the concatenated data, that would be super. So, spin through the end user worksheets, get only rows where date is between 22Jul13 and 28Jul13, and only concatenate that data. The manager would specify the start and end date in a couple of cells in the master workbook.
But at this point I'm happy for just a simple concatenation macro to get me started.
Thanks,
Scott