UDF to evaluate if row is hidden?

R

Ray

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
 
G

Gary''s Student

Public Function IsHidden(r As Range) As Boolean
Application.Volatile
IsHidden = r.EntireRow.Hidden
End Function
 
R

Ray

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
 
G

Gary''s Student

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top