Sorry... I had forgotten a needed external function: GetLastUsedRow


Anyway... the complete code is:

Sub HasFilter_in_Sheet()
   Dim oSheet
   Dim oFilterDesc
   oSheet = ThisComponent.currentController.activeSheet
       'current sheet
   For i = 2  to getLastUsedRow(oSheet)
      if oSheet.getRows().getByIndex(i).IsFiltered = true then
    if msgbox ("This sheet is filtered"& CHR$(10) & CHR$(10)_
        & "Remove All Filters ?" ,36, ""& CHR$(10)) = 6 then
       oFilterDesc = oSheet.createFilterDescriptor(True)
         oSheet.filter(oFilterDesc)
        end if
      exit sub
      end if
   Next I
   msgbox "NO filter in This sheet"
End sub

Function GetLastUsedRow(oSheet as Object) as Integer
Dim oCell As Object
Dim oCursor As Object
Dim aAddress As Variant
        oCell = oSheet.GetCellbyPosition(0, 0)
        oCursor = oSheet.createCursorByRange(oCell)
        oCursor.GotoEndOfUsedArea(True)
        aAddress = oCursor.RangeAddress
        GetLastUsedRow = aAddress.EndRow
End Function


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to