Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Counting visible rows

Hello.

I've searched and tried most of the day today, but so far I haven't
found a solution.

I have an autofiltered list where I need to perform operations on the
visible data only. It's some quite extensive lookup functions, and can
take a while to run. So I want to have my macro run on the visible
data only, not the entire 1000x70 table.

So far I have been able to determine the rownumber of the last piece
of data by using

Last = Cells(Rows.Count, 1).End(xlUp).Row

I can't figure out why
Last = UsedRange.Rows.SpecialCells(xlVisible, xlTextValues).Count
won't work, though.

How can I determine which row numbers to run my macro on? The data is
sorted, but not consecutive.
Maybe there is a way to determine if a row is visible before running
the code on it
Maybe there is a way to determine the first and last visible row, and
run the code on all rows in between, should be faster than running it
on all, but not very elegant.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Counting visible rows

With ActiveSheet.UsedRange
visRows = Application.Intersect(.Columns(1),
..SpecialCells(xlCellTypeVisible)).Count
End With

But I don't think that's what you want, maybe -

For r = firstRow To lastRow
If Not Rows(r).Hidden Then
For c = leftCol To rightCol
'process Cells(r, c)
Next
End If
Next

Regards,
Peter T


"atledreier" wrote in message
ps.com...
Hello.

I've searched and tried most of the day today, but so far I haven't
found a solution.

I have an autofiltered list where I need to perform operations on the
visible data only. It's some quite extensive lookup functions, and can
take a while to run. So I want to have my macro run on the visible
data only, not the entire 1000x70 table.

So far I have been able to determine the rownumber of the last piece
of data by using

Last = Cells(Rows.Count, 1).End(xlUp).Row

I can't figure out why
Last = UsedRange.Rows.SpecialCells(xlVisible, xlTextValues).Count
won't work, though.

How can I determine which row numbers to run my macro on? The data is
sorted, but not consecutive.
Maybe there is a way to determine if a row is visible before running
the code on it
Maybe there is a way to determine the first and last visible row, and
run the code on all rows in between, should be faster than running it
on all, but not very elegant.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
rows for visible cells mf_digger Excel Programming 2 December 20th 06 11:01 PM
Counting visible cells Otto Moehrbach Excel Programming 4 November 24th 06 07:04 PM
Counting rows, then counting values. Michael via OfficeKB.com Excel Discussion (Misc queries) 7 August 4th 05 10:57 PM
Counting Rows Then Counting Values in Columns Michael via OfficeKB.com Excel Programming 1 June 1st 05 04:10 PM
Counting visible cells Otto Moehrbach[_5_] Excel Programming 1 September 18th 03 03:01 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"