ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Font color (https://www.excelbanter.com/excel-programming/297221-font-color.html)

Dave Dawson

Font color
 
Using Excel 2k, I have this:
....
If intCount / 12 50 Then
intCount = 49.9 * 12
Selection.Font.ColorIndex = 3
Exit Do
End If
Loop

CCPayoutYears = intCount / 12

End Function...

in a function (CCPayoutYears) to compute years to pay off a credit card and
want to set the cell to 49.9 if it is over 50 years and set the font color
to red. intCount is the number of months accumulated in the loop.

It doesn't work. What am I missing?

Dave



Frank Kabel

Font color
 
Hi
do you call this function from your worksheet as worksheet formula. If
yes: no chance to change the format of a cell as user defined functions
can only return values but can't change the Excel environment

--
Regards
Frank Kabel
Frankfurt, Germany


Dave Dawson wrote:
Using Excel 2k, I have this:
...
If intCount / 12 50 Then
intCount = 49.9 * 12
Selection.Font.ColorIndex = 3
Exit Do
End If
Loop

CCPayoutYears = intCount / 12

End Function...

in a function (CCPayoutYears) to compute years to pay off a credit
card and want to set the cell to 49.9 if it is over 50 years and set
the font color to red. intCount is the number of months accumulated
in the loop.

It doesn't work. What am I missing?

Dave



Bob Phillips[_7_]

Font color
 
Assuming that this is a function called from a worksheet, you can't change
anything in a cell, only return a value. So you cannot set the font colour
from within that worksheet function.

--
HTH

-------

Bob Phillips
"Dave Dawson" wrote in message
...
Using Excel 2k, I have this:
...
If intCount / 12 50 Then
intCount = 49.9 * 12
Selection.Font.ColorIndex = 3
Exit Do
End If
Loop

CCPayoutYears = intCount / 12

End Function...

in a function (CCPayoutYears) to compute years to pay off a credit card

and
want to set the cell to 49.9 if it is over 50 years and set the font color
to red. intCount is the number of months accumulated in the loop.

It doesn't work. What am I missing?

Dave






All times are GMT +1. The time now is 09:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com