Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Establishing which rows are currently visible due to filtering

Hi,

I have an excel sheet with three colums, one called value, one called
status, and one called year. Value is simple a number and status is
one of 4 values: Implemented, not implemented, pending, canceled. I
have a filter on all three colums so that I can view selected data. I
also have a button which prints this table to a text file, by simply
stepping down through each line in the excel sheet. But how would I go
about writng only those values that are currently visible due to the
current filter choices? For example, if I wished to write only those
rows with status implemented and year 2005.

It would be nice if each row currently visible had a flag set on it. I
could the check this flag. Anyway, how would I go about solving this
problem?

Thanks,

Aine.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Establishing which rows are currently visible due to filtering

Aine, take a look at Range.SpecialCells(xlCellTypeVisible).Select in some
form.

There is also a (related?) command, Select Visible Cells, that can be added
to a toolbar (since it is not available in any standard menu or toolbar).

Regards,
George


wrote in message
ups.com...
Hi,

I have an excel sheet with three colums, one called value, one called
status, and one called year. Value is simple a number and status is
one of 4 values: Implemented, not implemented, pending, canceled. I
have a filter on all three colums so that I can view selected data. I
also have a button which prints this table to a text file, by simply
stepping down through each line in the excel sheet. But how would I go
about writng only those values that are currently visible due to the
current filter choices? For example, if I wished to write only those
rows with status implemented and year 2005.

It would be nice if each row currently visible had a flag set on it. I
could the check this flag. Anyway, how would I go about solving this
problem?

Thanks,

Aine.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Establishing which rows are currently visible due to filtering

Hi Aine,

As George mentioned you can use SpecialCells but...

It would be nice if each row currently visible had a flag set on it.


- each row has just such a property !

Sub test()
Dim rngRow As Range
Dim ws As Worksheet
Set ws = ActiveSheet

If ActiveSheet.AutoFilterMode Then

For Each rngRow In ActiveSheet.AutoFilter.Range.Rows

Debug.Print rngRow.Row, rngRow.Address(0, 0), Not rngRow.EntireRow.Hidden
Next

End If
End Sub

Press Ctrl-g to view the Immediate window and the debug results

Regards,
Peter T


wrote in message
ups.com...
Hi,

I have an excel sheet with three colums, one called value, one called
status, and one called year. Value is simple a number and status is
one of 4 values: Implemented, not implemented, pending, canceled. I
have a filter on all three colums so that I can view selected data. I
also have a button which prints this table to a text file, by simply
stepping down through each line in the excel sheet. But how would I go
about writng only those values that are currently visible due to the
current filter choices? For example, if I wished to write only those
rows with status implemented and year 2005.

It would be nice if each row currently visible had a flag set on it. I
could the check this flag. Anyway, how would I go about solving this
problem?

Thanks,

Aine.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Establishing which rows are currently visible due to filtering

On 15 Aug, 11:08, "Peter T" <peter_t@discussions wrote:
Hi Aine,

As George mentioned you can use SpecialCells but...

It would be nice if each row currently visible had a flag set on it.


- each row has just such a property !

Sub test()
Dim rngRow As Range
Dim ws As Worksheet
Set ws = ActiveSheet

If ActiveSheet.AutoFilterMode Then

For Each rngRow In ActiveSheet.AutoFilter.Range.Rows

Debug.Print rngRow.Row, rngRow.Address(0, 0), Not rngRow.EntireRow.Hidden
Next

End If
End Sub

Press Ctrl-g to view the Immediate window and the debug results

Regards,
Peter T

wrote in message

ups.com...



Hi,


I have an excel sheet with three colums, one called value, one called
status, and one called year. Value is simple a number and status is
one of 4 values: Implemented, not implemented, pending, canceled. I
have a filter on all three colums so that I can view selected data. I
also have a button which prints this table to a text file, by simply
stepping down through each line in the excel sheet. But how would I go
about writng only those values that are currently visible due to the
current filter choices? For example, if I wished to write only those
rows with status implemented and year 2005.


It would be nice if each row currently visible had a flag set on it. I
could the check this flag. Anyway, how would I go about solving this
problem?


Thanks,


Aine.- Dölj citerad text -


- Visa citerad text -


Cool, thanks for that!

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
How do I Copy and Paste onto Same Rows after filtering out rows. TWT Excel Discussion (Misc queries) 2 October 20th 08 04:09 PM
VBA to address first visible cell in Column "D" after filtering EagleOne Excel Discussion (Misc queries) 2 December 11th 06 05:22 PM
Re-establishing Links Me Excel Discussion (Misc queries) 0 December 9th 05 04:03 PM
Filtering a database then copying visible cells based on CurrentRe Peter Rooney Excel Programming 4 August 5th 05 10:05 AM
Establishing Rows to copy based on Offsets Tony Bender Excel Programming 2 October 22nd 04 04:03 AM


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

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

About Us

"It's about Microsoft Excel"