Excel merge cells

Solved
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

21 answers

  1. Good evening,

    put this macro in a module of your workbook
    Sub 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 Sub
    Select 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.
    18
    1. I tested this macro, it's working perfectly
      I've been dreaming of this forever ;-)
      thank you
      0
    2. Hello,

      How can we adapt this macro to merge 2 columns into a 3rd one?
      Because here we are merging 2 rows into the same cell.

      So I want A1 and A2 to be merged into A3.
      Thank you!
      0
    3. thank you, the macro is awesome!
      0
    4. Thank you JvDo, you have saved me a lot of time with this formula.
      You are my hero of the day :-)
      0
    5. function CONCATENATE() without too much hassle with macros!
      0