Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
gvm
 
Posts: n/a
Default font style of worksheet functions

I have a worksheet function as follows: ="the rate is special and equals
" & average(a1:a3)

I want to change the font style and color of the word "special" in the
character string to bold and green. I understand it can be done with event
macros. Thanking you in anticpiation, .... Greg
  #2   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Greg,

Copy the code below, right click the sheet tab, select "View Code", and paste the code in the window
that appears.

In another cell, put the formula
=AVERAGE(A1:A3)
to force a calc event whenever a value in A1:A3 changes.

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_Calculate()
Application.EnableEvents = False
Range("A4").Value = "The rate is special and equals " _
& Format(Application.Average(Range("A1:A3")), "0.00") _
& "."
With Range("A4").Characters(Start:=13, Length:=7).Font
.FontStyle = "Bold"
.ColorIndex = 50
End With
Application.EnableEvents = True
End Sub


"gvm" wrote in message
...
I have a worksheet function as follows: ="the rate is special and equals
" & average(a1:a3)

I want to change the font style and color of the word "special" in the
character string to bold and green. I understand it can be done with event
macros. Thanking you in anticpiation, .... Greg



  #3   Report Post  
gvm
 
Posts: n/a
Default

excellent Bernie, thank you. Now I'm having trouble applying same sort of
solution to a more complex problem but I will post that under a new question,
thanks again ... Greg

"Bernie Deitrick" wrote:

Greg,

Copy the code below, right click the sheet tab, select "View Code", and paste the code in the window
that appears.

In another cell, put the formula
=AVERAGE(A1:A3)
to force a calc event whenever a value in A1:A3 changes.

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_Calculate()
Application.EnableEvents = False
Range("A4").Value = "The rate is special and equals " _
& Format(Application.Average(Range("A1:A3")), "0.00") _
& "."
With Range("A4").Characters(Start:=13, Length:=7).Font
.FontStyle = "Bold"
.ColorIndex = 50
End With
Application.EnableEvents = True
End Sub


"gvm" wrote in message
...
I have a worksheet function as follows: ="the rate is special and equals
" & average(a1:a3)

I want to change the font style and color of the word "special" in the
character string to bold and green. I understand it can be done with event
macros. Thanking you in anticpiation, .... Greg




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben
 
Posts: n/a
Default font style of worksheet functions

Formulas can only return values......not change formatting.

One option is to paste specialvalues then manually format the result.


Gord Dibben MS Excel MVP

On Fri, 20 Jan 2006 10:07:02 -0800, "Eddy"
wrote:

Bernie,

How do I change the excel font style functions?
I have a function ="Helo "&(O30) and I want to make the content of O30 only
bold.
how to do it? Your help is greatly appreciated.
;
Thanks
Eddy



"gvm" wrote:

excellent Bernie, thank you. Now I'm having trouble applying same sort of
solution to a more complex problem but I will post that under a new question,
thanks again ... Greg

"Bernie Deitrick" wrote:

Greg,

Copy the code below, right click the sheet tab, select "View Code", and paste the code in the window
that appears.

In another cell, put the formula
=AVERAGE(A1:A3)
to force a calc event whenever a value in A1:A3 changes.

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_Calculate()
Application.EnableEvents = False
Range("A4").Value = "The rate is special and equals " _
& Format(Application.Average(Range("A1:A3")), "0.00") _
& "."
With Range("A4").Characters(Start:=13, Length:=7).Font
.FontStyle = "Bold"
.ColorIndex = 50
End With
Application.EnableEvents = True
End Sub


"gvm" wrote in message
...
I have a worksheet function as follows: ="the rate is special and equals
" & average(a1:a3)

I want to change the font style and color of the word "special" in the
character string to bold and green. I understand it can be done with event
macros. Thanking you in anticpiation, .... Greg






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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet Functions Nadji New Users to Excel 3 June 13th 05 05:21 PM
how to change the default font on the worksheet tabs? Mark Dvorkin Excel Discussion (Misc queries) 3 March 8th 05 03:55 AM
Weekly Transaction Processing Ralph Howarth Excel Worksheet Functions 4 January 19th 05 05:37 AM
Reference Data in Moved Worksheet tommcbrny Setting up and Configuration of Excel 1 December 1st 04 06:49 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 05:19 PM.

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

About Us

"It's about Microsoft Excel"