ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can I use a User-Defined Funcion in a Conditional Format formula? (https://www.excelbanter.com/excel-programming/278611-can-i-use-user-defined-funcion-conditional-format-formula.html)

Sally[_4_]

Can I use a User-Defined Funcion in a Conditional Format formula?
 
Doesn't see to work for me.

-Sal

J.E. McGimpsey

Can I use a User-Defined Funcion in a Conditional Format formula?
 
yes you can. What is your function and how are you trying to call
it.

This works for me:

Public Function foo(bar As Range)
foo = 2 * bar.Value
End Function


CF1: Formula is =foo(A1) <=10 == patterns/red

turns the background cell color red if the cell value <=5


In article ,
(Sally) wrote:

Doesn't see to work for me.

-Sal


Barmaley

Can I use a User-Defined Funcion in a Conditional Format formula?
 
it does work

"Sally" wrote in message
om...
Doesn't see to work for me.

-Sal




Sally[_4_]

Can I use a User-Defined Funcion in a Conditional Format formula?
 
"Barmaley" wrote in message ...
it does work

"Sally" wrote in message
om...
Doesn't see to work for me.

-Sal


ok, I jumped the gun, but there seems to be something weird here.

I have one user defined function, all it does is return the value sent
Function rowTestInteger(r As Integer) As Integer
rowTestInteger = r
End Function

I have 6 cells a1::b3
all with the formula =rowTestInteger(ROW())

results
1 1
2 2
3 3

So far fine

In column a, the conditional format is the same for all three
=rowTestInteger(ROW())=2
=rowTestInteger(ROW())=2
=rowTestInteger(ROW())=2

in Columns b, I change it a bit to
=rowTestInteger(b1)=2
=rowTestInteger(b2)=2
=rowTestInteger(b3)=2

I set the formats to background of red

a2 and b2 BOTH should be red, but only b2 is.
a2=2=ROW(), so it should be red too, but for some reason it is not!!!

-Sal


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

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