View Single Post
  #5   Report Post  
David McRitchie
 
Posts: n/a
Default

Very good John, I didn't pick up on the fact that the formula in
cell A1 (assigned in macro), that can't be partially formatted to
bold wasn't needed for calculations and could simply be eliminated
permanently as a formula and replaced with a text string that
can be partially formatted and whose value is calculated and
formatted in an event macro.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"JE McGimpsey" wrote...
XL formulae can't change formatting, so you can't do this with a
worksheet function. However, you can, using an event macro.

Put this in your worksheet code module (right-click on the worksheet tab
and choose View Code):

Private Sub Worksheet_Calculate()
Const sPREFIX As String = "Time Period: "
With Range("A1")
.Font.Bold = False
Application.EnableEvents = False
.Value = sPREFIX & _
Format(Range("From2").Value, "mm/dd/yyyy - ") & _
Format(Range("To2").Value, "mm/dd/yyyy")
Application.EnableEvents = True
.Characters(1, Len(sPREFIX)).Font.Bold = True
End With
End Sub





In article ,
"KimberlyC" wrote:

Hi,
Is there a way to add formatting to this formula to make the "Time Period: "
bold and leave the rest of it in regular text?

="Time Period: "& TEXT(From2,"mm/dd/yyyy")&" - "&TEXT(To2,"mm/dd/yyyy")

Thanks in advance for you help!!
Kimberly