将多个单元格内容复制到单个单元格中

时间:2017-10-24 01:37:43

标签: excel google-sheets

是否有可以执行以下操作的公式:

将A列第1行至第4行的所有内容复制到新单元格中,并使用新行分隔内容。

示例输入:

       | A                |
Row 1  | Alpha Beta Omega |
Row 2  |                  |
Row 3  | 21321 Cri Je     |
Row 4  | Cappa NF B       |

示例输出:

Row 5 | Alpha Beta Omega
        21321 Cri Je
        Cappa NF B        |

1 个答案:

答案 0 :(得分:1)

对于Google表格,

=TEXTJOIN(CHAR(10),1,A1:A4)

对于Google表格和Excel 2016(w / Office365),

Sub preserveBookMark()
    Dim rng As Range
    Dim bmName As String

    bmName = "UnitName"
    Set rng = ActiveDocument.Bookmarks(bmName).Range

    rng.Text = Me.AgisanangUnitNameInput.Value  ' deletes the bookmark
    rng.Bookmarks.Add ("bmName")                ' re-add deleted bookmark

    activedocument.Fields.Update
End Sub