ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I choose the rows that are filtered ? (https://www.excelbanter.com/excel-programming/395226-how-do-i-choose-rows-filtered.html)

cupertino

How do I choose the rows that are filtered ?
 
Here is part of my macro

'' Formatting Alan with color
Range("A1").Select
Application.CutCopyMode = False
ActiveWindow.DisplayGridlines = False
Selection.AutoFilter Field:=1, Criteria1:="Alan"
Selection.AutoFilter Field:=3, Criteria1:="=Alan"

''''''''''' why is the next line A2 ?
Range("A2").Select

''''''''''' Above line could be A20, how do How do I choose the rows that are filtered

isabelle

How do I choose the rows that are filtered ?
 
hi cupertino,

Sub Filtered_Data1()
'this example lists the data and addresses of the first (1) column of the filter

Dim S As Variant
Dim plg As Range, rng As Range, c As Range
Dim i As Integer, FirstAdd As String, LastAdd As String
Set plg = ActiveSheet.Range("_filterdatabase").SpecialCells( xlCellTypeVisible)

S = Split(plg.Address, ",")

For i = 0 To UBound(S)
For Each rng In Range(S(i)).Columns(1) 'adapt the "th" column
For Each c In Range(rng.Address)
If c.Address < ActiveSheet.Range("_filterdatabase")(1).Address Then 'adapt the "th" column
FirstAdd = c.Address
GoTo fin
End If
Next
Next
Next

fin:
LastAdd = Range(S(UBound(S))).Columns(1).Address
Range(FirstAdd & ":" & LastAdd).Select
End Sub


--
isabelle



Le 2012-02-15 19:08, cupertino a écrit :
Here is part of my macro

'' Formatting Alan with color
Range("A1").Select
Application.CutCopyMode = False
ActiveWindow.DisplayGridlines = False
Selection.AutoFilter Field:=1, Criteria1:="Alan"
Selection.AutoFilter Field:=3, Criteria1:="=Alan"

''''''''''' why is the next line A2 ?
Range("A2").Select

''''''''''' Above line could be A20, how do
How do I choose the rows that are filtered






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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com