I
imelda1ab
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
"&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