

To merge cells without data loss, combine all the cells you want to merge within a column and do the following: Select the cells to be combined. I added the macro through Developer-ribbon->Visual Basic->Insert->Module and just pasted the code there and saved it. If the other merged cells have been populated with data after merging, the data is not featured and it does not appear even after remerging the cells. When I go to debug screen this is marked: str = str + vbNewLine + cl I've tried to run the macro in different ways marking multiple columns, marking multiple rows and marking just some area but I'm always getting: If str "" Then str = Right(str, Len(str) - 2) If Not IsEmpty(cl) Then str = str + vbNewLine + cl

Set rng = Range(Cells(i, 2), Cells(i - cnt + 1, 2))

I have the same scenario (except I don't have any empty rows) so I just tried to use the code in the existing thread not really understanding the syntax: Sub mergecolumn()įor i = To 1 Step -1 Check for duplicate values before you proceed. If you are merging by using VLOOKUP, you need to be careful of duplicate entries in the lookup value. In Excel 2010 and in 2013, it is an add-in, and in excel 2016, it is a built-in function. POWER QUERY can merge many tables together. I'm trying to merge a lot of cells exactly like in this thread, but I'm kind of new to coding and especially excel/VBA so I don't get it to work. Things to Remember about Merge Two Tables in Excel. First of sorry for making a new thread about this but i wasn't able to comment in existing threads.
