ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   xlCellTypeVisible - not working? (https://www.excelbanter.com/excel-programming/363761-re-xlcelltypevisible-not-working.html)

Dave Peterson

xlCellTypeVisible - not working?
 
specialcells doesn't work if it's called from a function in a cell on a
worksheet.



whitehurst wrote:

Can somebody please explain where my misunderstanding of
SpecialCells(xlCellTypeVisible) is?

Example, a completely new workbook:

1. Name range "A1:E10" as "test".
2. Insert the following macros:

Public Function total(rng As Range)
total = rng.Cells.Count
End Function

Public Function shown(rng As Range)
shown = rng.SpecialCells(xlCellTypeVisible).Cells.Count
End Function

3. Insert '=total(test)' and '=shown(test)' into 2 cells not in the
range.

4. Both should say 50. Now, start hiding rows/columns intersecting the
'test' range. Even when using Ctrl-Alt-F9, the shown count always
equals 50 - why?! Hide all the cells in the range - still 50?! Why?

Does SpecialCells(xlCellTypeVisible) not do what I think it should?

Thanks!

--
whitehurst
------------------------------------------------------------------------
whitehurst's Profile: http://www.excelforum.com/member.php...o&userid=34544
View this thread: http://www.excelforum.com/showthread...hreadid=550123


--

Dave Peterson


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

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