Thanks, Bob,

I need to book my memory in for a service!

regards

Pete



"Bob Phillips" wrote:

> Function CountVisibleRows(TheRange)
> Dim CellToCount As Range
> Dim RunningTotal As Long
> RunningTotal = 0
> For Each CellToCount In TheRange.Rows
> If Not CellToCount.EntireRow.Hidden Then
> RunningTotal = RunningTotal + 1
> End If
> Next CellToCount
> CountVisibleRows = RunningTotal
> End Function
>
>
> --
> HTH
>
> Bob Phillips
>
> (remove xxx from email address if mailing direct)
>
> "Peter Rooney" <PeterRooney@discussions.microsoft.com> wrote in message
> news:D39F3702-1B19-485B-A3E9-92A3C961D0CE@microsoft.com...
> > This is what happens when you take a couple of months away from VBA...
> >
> > I'm trying to write a function to display the number of visible wows with

> a
> > range of cells.
> >
> > Function CountVisibleRows(TheRange)
> > Dim CellToCount As Range
> > Dim RunningTotal As Long
> > RunningTotal = 0
> > For Each CellToCount In TheRange
> > If CellToCount.Row.Hidden = False Then
> > RunningTotal = RunningTotal + 1
> > End If
> > Next CellToCount
> > CountVisibleRows = RunningTotal
> > End Function
> >
> > but I'm getting a message to say that .row is an invalid qualifier.
> > It's late in the day 9well, it is for me, anyway) and my brain has entered
> > the twilight zone.
> >
> > Can anyone please help?
> >
> > Thanks in advance
> >
> > Pete

>
>
>