View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tim Childs[_4_] Tim Childs[_4_] is offline
external usenet poster
 
Posts: 31
Default Code Snippet - Data Filter

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


"isabelle" wrote in message ...
correction,

Sub Filter_first_last()
Dim plg As Range, x As Variant, pr As String, dr As String
Set plg =
ActiveSheet.Range("_filterdatabase").SpecialCells( xlCellTypeVisible)
x = Split(plg.Address, ",")
If Range(x(0)).Rows.Count 1 Then
pr = Range(x(0)).Rows(2).Row 'first row
dr = Range(x(UBound(x))).Row 'last row
Else
pr = Range(x(1)).Row 'first row
dr = Range(x(UBound(x))).Row 'last row
End If
MsgBox "Fisrt: " & pr & " Last: " & dr
End Sub


isabelle