On Error Resume Next
If Selection.MergeCells = Then False
For Each Cll In Selection
If Cll <> "" Then Temp = Temp + Cll.Text + ""
Next Cll
Selection.Merge
Selection.Value = Left (Temp, Len (Temp) - 1)
Else
Selection.UnMerge
End If
Selection.HorizontalAlignment = xlCenter
Selection.VerticalAlignment = xlCenter
Step 4:
When you have entered the above code, click on the File button and select Close and Return to Microsoft Exce l to close this interface and return to Excel.
This code will automatically be saved to the computer, unless the user reinstalls Win. The next use just press Alt + F8 and press Run to run the command.
The results in the cells were combined into one box and no loss of data was shown.
So we already know how to include multiple cells in Excel, in case the content or contents in different cells are not entered. The content after merging cells will not disappear but will remain the same as before.
See more:
I wish you all success!