Sub MergeRanges()
Dim rng As Range, txt As String
For Each rng In Selection
txt = txt & rng.Value2
Next
Application.DisplayAlerts = False
Selection.Merge
Selection = txt
Application.DisplayAlerts = True
End Sub
当合并单元格时,我想保留单元格中的所有数据。我google了一段时间,找到上面的代码。但我不知道如何使用它?和他们的意义是什么。谢谢。如何使用以下excel vba代码?