xlCellTypeVisible - not working?

W

whitehurst

Can somebody please explain where my misunderstanding o
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 th
range.

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

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

Thanks
 
D

Dave Peterson

specialcells doesn't work if it's called from a function in a cell on a
worksheet.
 

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