concatenating 2 columns containing by retaining font properties like bold, color.

SHANMUKH

New Member
Joined
Jul 3, 2022
Messages
7
Office Version
  1. 2019
Platform
  1. Windows
I have 2 columns with text with parts of the text bolded and colored in each column. When I try to concatenate these 2 columns i get a column with black color and the normal text(boldness is missing). can you please help me in retaining the color of the text and boldness of the text.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
How are you concatenating the columns? If you are using VBA please show your code.

Doing this will require a bit of effort using VBA. Not sure if I have time to do it myself, but wanted to let you know what you're getting into.
 
Upvote 0
Just to follow up on Jeff's comment... if you are using a formula to concatenate the text, then you cannot format different parts of its resulting text differently from each other (all the characters in the text from a formula must have the same formatting)... you can only do that with text constants. So you will need to use VBA to do the concatenation and formatting.

Also, what is bolded and what is colored... the same piece of text or different pieces of text?
Also, is there any other formatting besides color and bold in the text?
 
Last edited:
Upvote 0
Just to follow up on Jeff's comment... if you are using a formula to concatenate the text, then you cannot format different parts of its resulting text differently from each other (all the characters in the text from a formula must have the same formatting)... you can only do that with text constants. So you will need to use VBA to do the concatenation and formatting.

Also, what is bolded and what is colored... the same piece of text or different pieces of text?
Also, is there any other formatting besides color and bold in the text?
some piece of text is both bolded and colored like bolded in red color whereas some piece of text is bolded in black.
How are you concatenating the columns? If you are using VBA please show your code.

Doing this will require a bit of effort using VBA. Not sure if I have time to do it myself, but wanted to let you know what you're getting into.
I don't know to code in VBA, I just have concatenated using concatenate formula. I have posted in this thread expecting some one would help by sharing the code that does this job, either by writing or directing me to someother thread where the same question was asked(if at all my question is repeated one).
 
Upvote 0
some piece of text is both bolded and colored like bolded in red color whereas some piece of text is bolded in black.
Is red the only color being used or can there be more than one color for some of the characters within the cells.

When characters are colored, are those characters always bold or could there be non-bold, colored characters?
 
Upvote 0
1656917674767.png
 
Upvote 0
this is how 2 columns look like , sorry the columns were lengthy and I didn't word wrap. Thanks in advance to any solution.
 
Upvote 0
only red & black has been used. An image of a part of those 2 columns has been attached above kindly look at it.
Is red the only color being used or can there be more than one color for some of the characters within the cells.

When characters are colored, are those characters always bold or could there be non-bold, colored characters?
 
Upvote 0
Is it are you looking for?
If you are new VBA user, try to :
Alt-F11 to open VBA edit window
Insert/module
Paste below code into right editing window
Hit F5 to run
VBA Code:
Option Explicit
Sub concatenatAndformat()
Dim lr&, i&, len1&, len2&, len3&, ce1 As Range, ce2 As Range, ce3 As Range
lr = Cells(Rows.Count, "A").End(xlUp).Row
For Each ce1 In Range("A1:A" & lr)
    Set ce2 = ce1.Offset(0, 1): Set ce3 = ce1.Offset(0, 2)
    len1 = Len(ce1): len2 = Len(ce2): len3 = Len(ce3)
    ce3 = ce1 & ce2
        For i = 1 To len3
            With ce3.Characters(i, 1).Font
                Select Case i <= len1
                    Case True
                        .Bold = ce1.Characters(i, 1).Font.Bold
                        .Color = ce1.Characters(i, 1).Font.Color
                    Case False
                        .Bold = ce2.Characters(i, 1).Font.Bold
                        .Color = ce2.Characters(i, 1).Font.Color
                End Select
            End With
        Next
Next
End Sub

BEFORE

before.JPG


AFTER

After.JPG
 
Upvote 0
Solution

Forum statistics

Threads
1,215,460
Messages
6,124,949
Members
449,198
Latest member
MhammadishaqKhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top