Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
gvm
 
Posts: n/a
Default changing type style and colour within a worksheet function

In another post, "JE McGimpsey" solved the following
problem:
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")


by doing this:
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
---------------------------------------------------------
Is a similar process recommended to change the word "special" to bold and
green in a worksheet function like this: ="the rate is special and equals
the " & average(etc etc
If so, how should the event macro be written?







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"