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代碼?