User Function returning #Value

tomexcel1

New Member
Joined
Feb 22, 2018
Messages
35
Hi All

I am currently using the below function to show if a row is hidden or not, when i first use the function it works perfectly but as soon as i unhide/hide a row all the values change to #VALUE . What am i doing wrong?

Code:
Public Function isvisible(rng As Range)
isvisible = Not (rng.EntireRow.Hidden)
End Function
Thanks All
Tom
 

Johnny C

Well-known Member
Joined
Nov 7, 2006
Messages
997
Have you tried putting ByRef or ByVal in? Try both and see
I would also specify the type of value returned by the function

Public Function isvisible(ByVal rng As Range) as Boolean
Public Function isvisible(ByRef rng As Range) as Boolean
 
Last edited:

tomexcel1

New Member
Joined
Feb 22, 2018
Messages
35
Hi Johnny

Thanks for those, still doesn't seem to work. I can make the #value go away when i click in to the cell and back out again. Cant understand why its doing this?

Thanks
Tom
 

Johnny C

Well-known Member
Joined
Nov 7, 2006
Messages
997
I'm not sure. It works for me in that I don't get an error, however I selected 3 lines and hid them. it returned TRUE, good. I unhid all 3 and it said FALSE, good. However when I start hiding odd ones it becomes unpredictable, it says whether the majority are hidden or not.
 

Forum statistics

Threads
1,078,367
Messages
5,339,783
Members
399,323
Latest member
letitiaysk

Some videos you may like

This Week's Hot Topics

Top