Excel merge cells
Solved
mike
-
Raph -
Raph -
Hello everyone, I have a cell where a word is written (in Excel), and below it a cell where another word is written. I would like to merge the two cells, but when I merge them, Excel informs me that only the value in the top left corner will be kept. How can I merge two cells that each contain a word?
Thank you
Thank you
21 answers
- 1
- 2
Next
-
Good evening,
put this macro in a module of your workbookSub eliot() Set vzone = Selection vtxt = vzone.Range("a1").Value For i = 2 To vzone.Rows.Count vtxt = vtxt & Chr(10) & vzone.Cells(i, 1).Value vzone.Cells(i, 1).ClearContents Next vzone.Range("a1").Value = vtxt With vzone .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = True End With vzone.Range("a1").Value = vzone.Range("a1").Value End SubSelect your 4 cells and run it.
It concatenates with line breaks everything that is contained in the left column of your selection.
It works with any number of rows and columns you want.
It would need to be improved to properly handle gaps.
Best regards.
- 1
- 2
Next