View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default count only the visible rows in a data table

Hi Eric

Dim rng As Range
Dim iCtr As Long

Set rng = Range("myTable")

iCtr = rng.Columns(1). SpecialCells(xlCellTypeVisible).Count

'Or, to exclude the header row:
iCtr = rng.Columns(1). SpecialCells(xlCellTypeVisible).Count -1

MsgBox iCtr



---
Regards,
Norman



"Eric" wrote in message
nk.net...
I have a defined name dynamic table of data and I want to know the number
of visible rows after it is filtered.

Using Application.Range("myTable").SpecialCells(xlVisibl eOnly).Count will
give all cells, not rows. I can take the top of a column in the table,
find the last non-blank cell, and then use specialCells, but it seems
there must be something a bit more elegant.

Tanks Much,
Eric