Voici le code permettant de supprimer les lignes (test sur la colonne A) et les colonnes (test sur la ligne 1) vides :
sub Vincent ()
dim document as object
dim dispatcher as object
dim feuile as object
dim args1(0) as new com.sun.star.beans.PropertyValue
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
Feuille = ThisComponent.getCurrentController().getActiveSheet()
dispatcher.executeDispatch(document, ".uno:GoToEndOfData", "", 0, args1())
CelluleActive = ThisComponent.getCurrentSelection
NbCol = CelluleActive.CellAddress.Column + 1
NbLig = CelluleActive.CellAddress.Row + 1
'Teste les lignes vides
for i = NbLig to 0 step -1
Cell = Feuille.getCellByPosition(0, i)
ThisComponent.currentController.select(Cell)
select case Cell.type
Case com.sun.star.table.CellContentType.EMPTY
ThisComponent.currentController.select(Cell)
dispatcher.executeDispatch(document, ".uno:DeleteRows", "", 0, Array())
end select
next
'Teste les colonnes vides
for i = NbCol to 0 step -1
Cell = Feuille.getCellByPosition(i, 0)
ThisComponent.currentController.select(Cell)
select case Cell.type
Case com.sun.star.table.CellContentType.EMPTY
ThisComponent.currentController.select(Cell)
dispatcher.executeDispatch(document, ".uno:DeleteColumns", "", 0, Array())
end select
next
end sub