Sub OrdenaHojas
Dim oHojas
Dim i As Integer
Dim Seguir As Boolean
oHojas = ThisComponent.Sheets
If oHojas.getCount() > 1 Then ‘ Si sólo hay una, no hay que ordenar 🙂
Do
Seguir = False ‘ Si Seguir se pone a true, repetirá el proceso
For i = 0 to oHojas.getCount()-2
If oHojas.getByIndex(i).Name > oHojas.getByIndex(i+1).Name Then
oHojas.moveByName(oHojas.getByIndex(i+1).Name,i)
Seguir = True ‘ Ha reordenado una hoja; Seguir = true para volver a empezar
End If
Next
Loop Until Seguir = False
End If
End Sub