View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
[email protected] imelda1ab@yahoo.com is offline
external usenet poster
 
Posts: 1
Default Different font characteristics in concatenated cell

I have a spreadsheet with the following formula: =IF(F2="",C2,F2&":
"&C2) which produces the desired result of CA: Los Angeles Facility
or if there is no code in F2,
Los Angeles Facility

How do I change the font characteristics of "CA:" in the concatenated
cell? I found the code below, but I'm not smart enough to update the
code from the actual text of " Bold Text " to reference instead (F2)
or the (F2)'s text in the cell with the formula (B2).

Any help is greatly appreciated!


Private Sub Worksheet_Calculate()
Const BoldText As String = " Bold Text "
Const ItalicText As String = " Italic Text "
Const DifferentSizedFontText As String = _
" Different Sized Font "


Application.EnableEvents = False
With Range("B1")
.Value = Range("A1").Text & BoldText & _
Range("A2").Text & ItalicText & _
Range("A3").Text & DifferentSizedFontText
.Characters(InStr(.Text, BoldText), _
Len(BoldText)).Font.Bold = True
.Characters(InStr(.Text, ItalicText), _
Len(ItalicText)).Font.Italic = True
.Characters(InStr(.Text, _
DifferentSizedFontText)).Font.Size = 24
End With
Application.EnableEvents = True
End Sub