View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
isabelle isabelle is offline
external usenet poster
 
Posts: 587
Default Code Snippet - Data Filter

Sub Filter_first_last2()
Dim plg As Range, x As Variant, first As String, last As String
Set plg =
ActiveSheet.Range("_filterdatabase").SpecialCells( xlCellTypeVisible)

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

last = Range(x(UBound(x))).Rows(Range(x(UBound(x))).Rows. Count).Row
'last row

If Range(x(0)).Rows.Count 1 Then
first = Range(x(0)).Rows(2).Row 'first row
Else
first = Range(x(1)).Row 'first row
End If

MsgBox "first: " & first & vbCrLf & "Last: " & last
End Sub


http://cjoint.com/?CBxvf5eIikQ

isabelle

Le 2013-02-23 14:04, Tim Childs a écrit :
Hi Isabelle

Thanks for response. Did you test it because for me it provided the
correct answer for the first filtered row but not the last..

Look forward to hearing from you

Tim