A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
As I said this is not easy and you need a totally different code architecture for that as Vijay's "quick" code.
I don't know if you understand the code below, unfortunately, it takes a lot of experience and understanding how objects and VBA work.
Andreas.
Sub Test()
Dim Source As Range, Dest As Range, This As Range
Dim FontProperties, Delimiter, Item, Value
Dim f As Long, i As Long
'Names of all font properties
FontProperties = Array("Bold", "Color", "FontStyle", "Italic", "Name", "Size", "Strikethrough", "Subscript", "Superscript", "ThemeColor", "ThemeFont", "TintAndShade", "Underline")
'Errors off, we handle all by oruself
On Error Resume Next
'Get the user input
Set Source = Application.InputBox("Select all cells to combine", "Source", Selection.Address, Type:=8)
If Source Is Nothing Then Exit Sub
Do
Set Dest = Application.InputBox("Select the destination cell", "Dest", Selection.Address, Type:=8)
If Dest Is Nothing Then Exit Sub
If Not Intersect(Source, Dest) Is Nothing Then
MsgBox "The destination cell can not be inside the source cells", vbExclamation, "Error"
End If
Loop Until Intersect(Source, Dest) Is Nothing
Delimiter = Application.InputBox("Optional Delimiter (use ^ for a line break)", "Delimiter", Type:=2)
If Delimiter = "^" Then Delimiter = vbLf
'Copy all values into the destination cell
Dest.Clear
For Each This In Source
Dest = Dest & This & Delimiter
Next
Dest = Left(Dest, Len(Dest) - Len(Delimiter))
'Now we have to copy over the font property for each char!
f = 0
For Each This In Source
For i = 1 To This.Characters.Count
With Dest.Characters(f + i, 1)
For Each Item In FontProperties
Value = Null
Value = CallByName(This.Characters(i, 1).Font, Item, VbGet)
If Not IsNull(Value) Then
CallByName .Font, Item, VbLet, Value
End If
Next
End With
Next
f = f + Len(This) + Len(Delimiter)
Next
End Sub