merci beaucoup,
ça a fonctionné !
Bon week-end,
Cordialement
Pascal Léval
Le 04/05/2023 à 13:02, jean-francois a écrit :
Bonjour Pascal,
> J'ai un document Libreoffice Calc contenant 150 feuilles, et je
> souhaiterais les renommer automatiquement de " 1" à "150" tout en
> gardant leur ordre.
> Avez-vous une méthode ou une macro pour cela ?
cette macro doit le faire :
8< -----------------------------------------
Sub RenommerToutesLesFeuilles()
Dim oDoc As Object
Dim oSheet As Object
oDoc = ThisComponent
For i = 0 To ThisComponent.Sheets.Count - 1
    oSheet = ThisComponent.Sheets(i)
    oSheet.Name = CStr(i +1)
Next i
End Sub
----------------------------------------- >8
Attention : il est important qu'aucune feuille existante ne porte déjà 
un des nouveaux noms (numéros) à créer.
Si tu veux mettre un préfixe, la ligne
    oSheet.Name = CStr(i +1)
peut s'écrire
    oSheet.Name = "MonPrefixe" & CStr(i +1)
Très cordialement,
--
Envoyez un mail à users+unsubscribe@fr.libreoffice.org pour vous désinscrire
Les archives de la liste sont disponibles à https://listarchives.libreoffice.org/fr/users/
Privacy Policy: https://www.documentfoundation.org/privacy
Context
   
 
  Privacy Policy |
  
Impressum (Legal Info) |
  
Copyright information: Unless otherwise specified, all text and images
  on this website are licensed under the
  
Creative Commons Attribution-Share Alike 3.0 License.
  This does not include the source code of LibreOffice, which is
  licensed under the Mozilla Public License (
MPLv2).
  "LibreOffice" and "The Document Foundation" are
  registered trademarks of their corresponding registered owners or are
  in actual use as trademarks in one or more countries. Their respective
  logos and icons are also subject to international copyright laws. Use
  thereof is explained in our 
trademark policy.