Hello vbadumb
excelfox is a place to further the knowledge of excel: it is for people to get excel help from other people.
So tell us a bit more about what you are trying to do and why. That might help us to give the best help
_..Alternatively, if you just want to post anonymous question, best try one of the larger forums in future , like
mrexcel.com
or
excelforum.com
Here is what you gave as sample data, and wanted results, and macro results: https://excelfox.com/forum/showthrea...ll=1#post15293
https://excelfox.com/forum/showthrea...ll=1#post15293
Here is a macro to get you started https://excelfox.com/forum/showthrea...ll=1#post15294 .
Here is a brief summary of what is going on in the macro that I have done for you
I capture your data from the first worksheet into an array, arrIn() = WsIn.Range("B1:F5").Value2
I loop through the header columns, For Clm = 1 To 5 Step 1 , ( and do nothing if any column headers are empty
If I have a header, then I note that in variable Itms
I then go down the data rows, For RwDta = 2 To 5 Step 1
If I don’t have any data in a row , I do nothing. Otherwise I try to fill a string, strOutB , with as much data as is in a cell. I continually add to that string. I separate that data with a line feed ( vbCr & vbLf ) . I could use any character , ( provided its one that doesn’t appear in any data ) , but the line feed is convenient because I could also view my data in a message box or in the immediate window.
In each loop, I can determine the number of times I need to have the header by the number of elements I get from an array made from strOutB split by the vbCr & vbLf
The header data wanted in column A of the output goes into a similar string, strOutA
Please let us know how you get on with it.
Alan




Reply With Quote

Bookmarks