rdetreville
New Member
- Joined
- Jul 23, 2014
- Messages
- 38
Hello! First of all, I would like to say this website has been my saving grace for years. I'm so happy it exists and have learned so very much from members of this forum for years now.
This is my first official post. I'm under the gun to finish a tool for my job and am at a brick wall.
I'm creating a report generation tool that grabs data from hundreds of separate workbooks on a server and merges them into one. I have been successful so far and my data is now aligned on one worksheet and I have written all sorts of macros to clean up and scrub the data. What I'm left with now is basically repeating types of data (tables almost) going horizontally across the worksheet, with the same column headers: "Tracker Name" , "Team Member" , and then Month-Year columns: "May-2015", "June-2015", etc. I've attached a picture if this helps. All sets of data start with the "Tracker Name" and "Team Member" column and all begin with the same month but have different amounts of months after the first month column (some more, some less). All clusters are separated by a blank column.
I've now got to get the data into one big vertical table, so that I can create a PivotTable and actually use the data. I'm so close!
I've brainstormed countless ways to make this happen, and have come close with some methods, but am still stuck.
The primary way I've been attempting was to loop through the header row, find every instance of "Tracker Name" (the first column for each cluster) and then use the "ActiveCell.CurrentRegion.Select" feature to grab each "table" and actually turn it into a table. Then I was thinking I could delete all data not in a table and then somehow "stack" all the tables on top of each other on a new worksheet, all alligning in Column 1, and then turn all the tables back to ranges, remove the duplicate headers. But when I have tried various methods to find each cluster, and then select the current region, it messes up my being able to find the next cluster
Example code:
I can see the data I need right in front of me! I just need to "stack" these columns on top of each other. A picture of my data is below. If anyone could help, I would be most appreciative. Thanks!!!
Richard
This is my first official post. I'm under the gun to finish a tool for my job and am at a brick wall.
I'm creating a report generation tool that grabs data from hundreds of separate workbooks on a server and merges them into one. I have been successful so far and my data is now aligned on one worksheet and I have written all sorts of macros to clean up and scrub the data. What I'm left with now is basically repeating types of data (tables almost) going horizontally across the worksheet, with the same column headers: "Tracker Name" , "Team Member" , and then Month-Year columns: "May-2015", "June-2015", etc. I've attached a picture if this helps. All sets of data start with the "Tracker Name" and "Team Member" column and all begin with the same month but have different amounts of months after the first month column (some more, some less). All clusters are separated by a blank column.
I've now got to get the data into one big vertical table, so that I can create a PivotTable and actually use the data. I'm so close!
I've brainstormed countless ways to make this happen, and have come close with some methods, but am still stuck.
The primary way I've been attempting was to loop through the header row, find every instance of "Tracker Name" (the first column for each cluster) and then use the "ActiveCell.CurrentRegion.Select" feature to grab each "table" and actually turn it into a table. Then I was thinking I could delete all data not in a table and then somehow "stack" all the tables on top of each other on a new worksheet, all alligning in Column 1, and then turn all the tables back to ranges, remove the duplicate headers. But when I have tried various methods to find each cluster, and then select the current region, it messes up my being able to find the next cluster
Example code:
Code:
Sub govert2()
Dim lColumn As Long
Dim iCntr As Long
Dim myrange As Range
lColumn = 10000
For iCntr = lColumn To 1 Step -1
If Cells(1, iCntr).Value = "Tracker Name" Then ActiveCell.Select
If Cells(1, iCntr).Value = "Tracker Name" Then ActiveCell.CurrentRegion.Select
If Cells(1, iCntr).Value = "Tracker Name" Then ActiveSheet.ListObjects.Add(xlSrcRange, Selection, , xlYes).Name = “Table2”
Next
End Sub
I can see the data I need right in front of me! I just need to "stack" these columns on top of each other. A picture of my data is below. If anyone could help, I would be most appreciative. Thanks!!!
Richard
