1、在键盘上按住 Alt 键并点击 F11 键打开Microsoft Visual Basic for Application 窗口。

2、点击插入 >> 模块,并将下面的VBA 复制到模块窗口里。

Function Combine(WorkRng As Range, Optional Sign As String = ",") As String
'Update 20130815
Dim Rng As Range
Dim OutStr As String
For Each Rng In WorkRng
If Rng.Text <> "," Then
OutStr = OutStr & Rng.Text & Sign
End If
Next
Combine = Left(OutStr, Len(OutStr) - 1)
End Function

3、在空白单元格中输入公式 =Combine(A1:C1),并点击键盘上的 Enter 键。这样区域 A1:C1 的单元格内容都被合并到了一个单元格中,并以逗号分隔合并内容。

 

转载自 https://www.extendoffice.com/documents/excel/zh-cn-excel/2782-combine-cells-with-space-commas-semicolon.html

 

By charlie

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注