View Single Post
  #35   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Summing non hidden values in a range

Thanks for testing.

(I'll try to remember it.)

Bob Phillips wrote:

Nope, no good in 2000 or 97.

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"Dave Peterson" wrote in message
...
xl2003, too. But I don't recall if that ever changed from previous

versions.

Bob Phillips wrote:

Still need to force a recalc, at least in XP you do.

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"Dave Peterson" wrote in message
...
Try adding:

Application.volatile

to the top of the procedu

Function TOTAL_VISIBLE(rng As Range) As Long
application.volatile

....


This tells excel to recalculate the function whenever excel

recalculates.

If I recall correctly, some versions of excel won't recalc when

columns
are
hidden/unhidden--maybe all versions??? (Changing the columnwidth--not
hiding/showing--causes a recalc in xl2003, though.)

So for UDFs like these, you'll want to force a recalc before you trust

the
results.



Biff wrote:

Did you enter a valid range? (eg: =total_visible(A1:A4) )

Yes. I got it to return a sum but it doesn't change when columns are
hidden
and I calculate.

I had changed the function name but didn't realize it was called

later
in
the procedure. I changed it back.

Biff

"Ardus Petus" wrote in message
...
Works fine by me.

Did you enter a valid range? (eg: =total_visible(A1:A4) )

--
AP

"Biff" a écrit dans le message de news:
...
Ardus, I tried your UDF but I get a result of 0 all the time

(with or
without hidden columns)

Biff

"Ardus Petus" wrote in message
...
I don't have XL 2003 either..

Sounds like you need an UDF.

Here is some code you can paste in a Module

'------
Function TOTAL_VISIBLE(rng As Range) As Long
Dim c As Range
For Each c In rng
With c
If Not .EntireColumn.Hidden Then
TOTAL_VISIBLE = TOTAL_VISIBLE + .Value
End If
End With
Next c
End Function
'---------

"starguy"

a
écrit
dans le message de news:
...

what should I do. I need it... any body esle...


--
starguy


-----------------------------------------------------------------------
-
starguy's Profile:

http://www.excelforum.com/member.php...o&userid=32434
View this thread:
http://www.excelforum.com/showthread...hreadid=537953








--

Dave Peterson


--

Dave Peterson


--

Dave Peterson