ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   UDF to evaluate if row is hidden? (https://www.excelbanter.com/excel-programming/406696-udf-evaluate-if-row-hidden.html)

Ray

UDF to evaluate if row is hidden?
 
hi -

I'd like to build a UDF to evaluate (true/false) whether a cell is in
a hidden row ... I'll then use this UDF in a conditional format
statement to change the font color of a cell.

As example, I'll have a string in A20 (eg October) ... default font
color is white (aka invisible). However, if cell A19 is hidden (using
outline), then font color of A20 should be black.

I know how to do the conditional format ... but building the UDF is
throwing me off, as I've never built my own. I would image the final
output would be: =IsHidden(A19)

Can anyone help out with this?

TIA,
Ray

Gary''s Student

UDF to evaluate if row is hidden?
 
Public Function IsHidden(r As Range) As Boolean
Application.Volatile
IsHidden = r.EntireRow.Hidden
End Function

--
Gary''s Student - gsnu2007d


"Ray" wrote:

hi -

I'd like to build a UDF to evaluate (true/false) whether a cell is in
a hidden row ... I'll then use this UDF in a conditional format
statement to change the font color of a cell.

As example, I'll have a string in A20 (eg October) ... default font
color is white (aka invisible). However, if cell A19 is hidden (using
outline), then font color of A20 should be black.

I know how to do the conditional format ... but building the UDF is
throwing me off, as I've never built my own. I would image the final
output would be: =IsHidden(A19)

Can anyone help out with this?

TIA,
Ray


Ray

UDF to evaluate if row is hidden?
 
Perfect, Gary ... UDF and conditional formatting worked exactly as I'd
hoped!

one question: what does 'Application.Volatile' mean? why is it
necessary?

thanks,
ray



Gary''s Student

UDF to evaluate if row is hidden?
 
The statement help to insure the function will be called. Sometimes Excel
thinks its really smart and avoids calling a function if it thinks the
argument has not changed.
--
Gary''s Student - gsnu2007d


"Ray" wrote:

Perfect, Gary ... UDF and conditional formatting worked exactly as I'd
hoped!

one question: what does 'Application.Volatile' mean? why is it
necessary?

thanks,
ray





All times are GMT +1. The time now is 12:11 PM.

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