I need your help in this case:
I have:
1 11 111 Cat1 a,b,c 2 22 222 Cat2 d 3 33 333 Cat3 e,f 4 44 444 Cat4 g,h,i
and i want:
1 11 111 Cat1 a 1 11 111 Cat1 b 1 11 111 Cat1 c 2 22 222 Cat2 d 3 33 333 Cat3 e 3 33 333 Cat3 f 4 44 444 Cat4 g 4 44 444 Cat4 h 4 44 444 Cat4 i
you can help me to make this macro? I have written 5 columns but i need the macro for 20 columns but the best will be that i can choose the number of columns in the macro.
Its near that this case but with more columns: Excel Macro – Comma Separated Cells to Rows Preserve/Aggregate Column
Thanks!
This code should be what you are looking for, the method
ExpandData(String, String, String)takes the start column for the set of data (in this case ‘A’) for the first parameter, the end column for the set of data to copy as the second parameter (in this case ‘D’) and finally the column with the set of data that is comma seperated (‘E’ here).You should probably expand it so that it also takes a starting row or just make it an addin formula thing where it takes a range and a column.
Hope this helps.