Hi, I'm new so be gentle. This is a bit complex for me so I'm completely lost.
Below is an example of what I receive from our system, except imagine it about 200 columns across and up to 8,000 rows down. So manual manipulation is not only horrid but a risk of error.
Column's 'A' and 'B' are basic data. Column 'C' is the start date for the hours listed in Column's D-F. Columns D-F represent months that will go in order beginning with the date in column 'C'. So for instance in row 2, the start date is Dec-13, thus in row Month 1 is Dec-13, Month 2 would be Jan-14, and Month 3 would be Feb-2014. The logic continues for each row.
[TABLE="class: grid, width: 500"]
<TBODY>[TR]
[TD][/TD]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD]E
[/TD]
[TD]F
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]ID
[/TD]
[TD]Group
[/TD]
[TD]Start Date
[/TD]
[TD]Month 1
[/TD]
[TD]Month 2
[/TD]
[TD]Month 3
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]Number 1
[/TD]
[TD]A.02
[/TD]
[TD]Dec-13
[/TD]
[TD]46
[/TD]
[TD]5
[/TD]
[TD]12
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]Number 2
[/TD]
[TD]A.04
[/TD]
[TD]Jan-14
[/TD]
[TD]16
[/TD]
[TD]25
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]Number 3
[/TD]
[TD]A.01
[/TD]
[TD]Sep-13
[/TD]
[TD]3
[/TD]
[TD]3
[/TD]
[TD]6
[/TD]
[/TR]
</TBODY>[/TABLE]
Below is what I need to get to with VBA code. (Ignore the font colors, they are just there for emphasis)
I need the code to go to another specified sheet, (let's assume the headers below are already there) and populate the data as you see it below.
I hope I've explained this well. I cannot stress enough that the data will always come to me in that above table originating format and the columns and rows go on forever. So I'm dealing with massive amounts of data. I need this to be automated so as to minimize error and stop me from weeping softly in the corner whenver it's time to begin this task. Any help you can provide is appreciated. If you need more data or an attachment just let me know.
[TABLE="class: grid, width: 500"]
<TBODY>[TR]
[TD][/TD]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]ID
[/TD]
[TD]Group
[/TD]
[TD]Month
[/TD]
[TD]Hours
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]Number 1
[/TD]
[TD]A.02
[/TD]
[TD]Dec-13
[/TD]
[TD]46
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]Number 1
[/TD]
[TD]A.02
[/TD]
[TD]Jan-14
[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]Number 1
[/TD]
[TD]A.02
[/TD]
[TD]Feb-14
[/TD]
[TD]12
[/TD]
[/TR]
[TR]
[TD]5
[/TD]
[TD]Number 2
[/TD]
[TD]A.04
[/TD]
[TD]Jan-14
[/TD]
[TD]16
[/TD]
[/TR]
[TR]
[TD]6
[/TD]
[TD]Number 2
[/TD]
[TD]A.04
[/TD]
[TD]Feb-14
[/TD]
[TD]25
[/TD]
[/TR]
[TR]
[TD]7
[/TD]
[TD]Number 2
[/TD]
[TD]A.04
[/TD]
[TD]Mar-14
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]8
[/TD]
[TD]Number 3
[/TD]
[TD]A.01
[/TD]
[TD]Sep-13
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD]9
[/TD]
[TD]Number 3
[/TD]
[TD]A.01
[/TD]
[TD]Oct-13
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD]10
[/TD]
[TD]Number 3
[/TD]
[TD]A.01
[/TD]
[TD]Nov-13
[/TD]
[TD]6
[/TD]
[/TR]
</TBODY>[/TABLE]
Below is an example of what I receive from our system, except imagine it about 200 columns across and up to 8,000 rows down. So manual manipulation is not only horrid but a risk of error.
Column's 'A' and 'B' are basic data. Column 'C' is the start date for the hours listed in Column's D-F. Columns D-F represent months that will go in order beginning with the date in column 'C'. So for instance in row 2, the start date is Dec-13, thus in row Month 1 is Dec-13, Month 2 would be Jan-14, and Month 3 would be Feb-2014. The logic continues for each row.
[TABLE="class: grid, width: 500"]
<TBODY>[TR]
[TD][/TD]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD]E
[/TD]
[TD]F
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]ID
[/TD]
[TD]Group
[/TD]
[TD]Start Date
[/TD]
[TD]Month 1
[/TD]
[TD]Month 2
[/TD]
[TD]Month 3
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]Number 1
[/TD]
[TD]A.02
[/TD]
[TD]Dec-13
[/TD]
[TD]46
[/TD]
[TD]5
[/TD]
[TD]12
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]Number 2
[/TD]
[TD]A.04
[/TD]
[TD]Jan-14
[/TD]
[TD]16
[/TD]
[TD]25
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]Number 3
[/TD]
[TD]A.01
[/TD]
[TD]Sep-13
[/TD]
[TD]3
[/TD]
[TD]3
[/TD]
[TD]6
[/TD]
[/TR]
</TBODY>[/TABLE]
Below is what I need to get to with VBA code. (Ignore the font colors, they are just there for emphasis)
I need the code to go to another specified sheet, (let's assume the headers below are already there) and populate the data as you see it below.
- I need each ID to have a row for the amount of months there are. (In this case 3 months, in my true case usually about 200 months.)
- The ID is duplicated on each row
- The corresponding group (column V is duplicated on each row
- Column 'C' in the "first" row of each ID on the destination sheet (reference red rows) should have the corresponding start date as column 'C' on the originating sheet. (i.e. cell C2 below matches 'C2' on start sheet, cell 'C5' matches 'C3' and so on)
- The dates below each of the "first" (red rows) in column 'C' should be based on the date in the cell above it.
- The data in column 'D' should be pulled from columns D-F of each ID on the starting sheet in order of the columns. Basically what happens here it sees that the start date for the info on the originating sheet, populates that in the starting row of each ID, then populates the next month below it for as many months as there are on the originating sheet.
- I would need this to continue to loop for as much data is on the originating sheet.
I hope I've explained this well. I cannot stress enough that the data will always come to me in that above table originating format and the columns and rows go on forever. So I'm dealing with massive amounts of data. I need this to be automated so as to minimize error and stop me from weeping softly in the corner whenver it's time to begin this task. Any help you can provide is appreciated. If you need more data or an attachment just let me know.
[TABLE="class: grid, width: 500"]
<TBODY>[TR]
[TD][/TD]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]ID
[/TD]
[TD]Group
[/TD]
[TD]Month
[/TD]
[TD]Hours
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]Number 1
[/TD]
[TD]A.02
[/TD]
[TD]Dec-13
[/TD]
[TD]46
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]Number 1
[/TD]
[TD]A.02
[/TD]
[TD]Jan-14
[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]Number 1
[/TD]
[TD]A.02
[/TD]
[TD]Feb-14
[/TD]
[TD]12
[/TD]
[/TR]
[TR]
[TD]5
[/TD]
[TD]Number 2
[/TD]
[TD]A.04
[/TD]
[TD]Jan-14
[/TD]
[TD]16
[/TD]
[/TR]
[TR]
[TD]6
[/TD]
[TD]Number 2
[/TD]
[TD]A.04
[/TD]
[TD]Feb-14
[/TD]
[TD]25
[/TD]
[/TR]
[TR]
[TD]7
[/TD]
[TD]Number 2
[/TD]
[TD]A.04
[/TD]
[TD]Mar-14
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]8
[/TD]
[TD]Number 3
[/TD]
[TD]A.01
[/TD]
[TD]Sep-13
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD]9
[/TD]
[TD]Number 3
[/TD]
[TD]A.01
[/TD]
[TD]Oct-13
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD]10
[/TD]
[TD]Number 3
[/TD]
[TD]A.01
[/TD]
[TD]Nov-13
[/TD]
[TD]6
[/TD]
[/TR]
</TBODY>[/TABLE]
Last edited: