

If you don’t want that to be the case, you will need to find the max used column and merge by that column index Therefore, some merged cells will span 2 columns and some will span 3.

Each merge size is dependent on each rows furthest right non-blank column. This is dynamic by row ( determined by Column A) and column. I never recommend merging cells, but if you must. If it helps, before on left, after on right: How do I get this to loop properly through each row? 'Looping through A column define max valueĬell_value = (1, i).value OutputText = outputText & cell.value & delimĪnd here's what I've got as far as trying to get it to look through each row. 'and puts the resulting text in top most cell

Here is what I have so far: Sub JoinAndMerge() I managed to get some code together that will combine the cells properly, but I'm struggling to use this code to look through each row and combine the cells in that row, for all rows that contain data. I need each row to combine the data in the respective row without losing any of the data from any columns. I'm getting data that is in 1, 2, or 3 columns (possibly more).
