I have applied the code from the question posted March 20,2016 (https://computing.net/answers/office/how-to-make-bold-fonts-in-a-concatenated-text-in-excel/20253.html), but the code doesn’t determine the length of the text to bold, the code bolds all the text from the startChar to the end of the string. What do I need to add to bold ONLY the concatenated value from one of the cells in the string?
This is the code I am using:
Sub BoldSomeText2()
‘Copy Text From L21 to A26
Range(“DeclaredISOYield”) = Range(“L21”).Value
‘Loop through B9,L23,and L24
For Each txtStr In Range(“B9,L23,L24”)
‘Determine Start Position of text within L21
startChar = InStr(1, Range(“StatedYield”), txtStr)
‘Determine Length of text
lenBold = Len(txtStr)
‘Bold specific characters
Range(“DeclaredISOYield”).Characters(31, txtStr).Font.Bold = True
Next
End Sub
My intent is to create a report in which the numeric result of a formula that appears in a cell (B9, in this case) concatenates with content from other cells, but only the variable numeric value from B9 is in bold face.
Thank you for your help!
how are the cells concatenated?
Cell 1 Cell 2
123 Mouse
does the string get concatenated like 123Mouse or Mouse123?
Look at this code for example
if in range A1 you have 123Mouse the code will bold the numbers so the result will be
123Mouse
So the concept is possible just need to know a few details as per above.
message edited by AlwaysWillingToLearn