View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Steve[_4_] Steve[_4_] is offline
external usenet poster
 
Posts: 184
Default Bold items within text string

Hi All,

I found a bit of code on the newsgroup that bolds the text within a
cell during a concatenation of several cells:
Sub BoldNotesTitle()

Dim s As String, sA1 As String, sA2 As String
Const s1 As String = "On "
Const s2 As String = ", please "
Const s3 As String = " funds for a margin call."


sA1 = Range("A1").Text
sA2 = Range("A2").Text


With Range("A4")
.Value = s1 & sA1 & s2 & sA2 & s3
.Characters(1 + Len(s1), Len(sA1)).Font.Bold = True
.Characters(1 + Len(s1) + Len(sA1) + Len(s2), Len(sA2)).Font.Bold
= True
End With

End Sub

I'm trying to take this concept and apply it to a range. I wrote a
formula (below) that does the concatenation I need. Somehow I need to
take my formula into code and BOLD the cells J$1, K$1, L$1, M$1, N$1.
My biggest question is how to I apply this formula to the range
H2:H500? Thanks!

=IF(ISBLANK(J2),"",J$1&" - "&J2&CHAR(10))&IF(ISBLANK(K2),"",K$1&" -
"&K2&CHAR(10))&IF(ISBLANK(L2),"",L$1&" -
"&L2&CHAR(10))&IF(ISBLANK(M2),"",M$1&" -
"&M2&CHAR(10))&IF(ISBLANK(N2),"",N$1&" - "&N2&CHAR(10))