PC Review


Reply
Thread Tools Rate Thread

Counting visible rows

 
 
atledreier
Guest
Posts: n/a
 
      1st Aug 2007
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 With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      1st Aug 2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting characters in multiple rows when rows meet specific criteria news.virginmedia.com Microsoft Excel Worksheet Functions 3 28th Jun 2008 09:03 PM
DataGrid, Windows - Does not refresh. data is in the rows but they are not visible, the rows are solid blue Richard Microsoft C# .NET 1 2nd Sep 2005 01:56 PM
Counting Rows Then Counting Values in Columns Michael via OfficeKB.com Microsoft Excel Programming 1 1st Jun 2005 04:10 PM
counting rows counting empty rows cparsons Microsoft Excel Misc 1 10th Nov 2004 07:12 PM
Counting only visible rows and not using a filter Carl Olsson Microsoft Excel Worksheet Functions 2 26th Feb 2004 08:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:18 PM.