bonjour, macro multiple

je souhaite créer un tableau avec ligne IMMAT nom prénom BAT date de naissance etc… chaque ligne peut etre modifier au gré des jours entrée / sortie.

IMMAT NOM PRENOM BAT ENTREE
1 DUPOND FRANCOIS A 30/02/2020
2 DURAND ERIC B 15/02/2020

Ma macro pour recopie une ligne sur les documents des feuilles 2, 3 etc…

Sub MAJ()
rem
rem MAJ Macro
rem

rem
    Range("C5:G5").Select
    Selection.Copy
    Sheets("Feuil2").Select
    Range("B4").Select
    Sheets(Array("Feuil2", "Feuil3")).Select
    Sheets("Feuil2").Activate
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
    Sheets(Array("Feuil2", "Feuil3")).Select
    Sheets("Feuil2").Activate
End Sub

comment faire pour que cette macro fonctionne sur chaque ligne quand je change les entrées de chaque ligne?

Merci.

Bonjour

Remarque préalable, ceci est une macro VBA Excel, il faudrait donc commencer ton module avec l’instruction :

Option VBASupport 1

Néanmoins, si cette instruction permet d’utiliser la syntaxe VBA, toutes les instructions ne sont pas fonctionnelles.
La programmation de macro avec LibreOffice peut être faite en mode “enregistrement”, mode simple pour les utilisateurs mais limité, ou via l’API, non limité mais supposant une connaissance de la programmation.

Ci-dessous un exemple de transposition de ta procédure qui mixe un peu des deux approches :

Sub Pys()

dim oSheet as object, document   as object
dim dispatcher as object
dim args1(0) as new com.sun.star.beans.PropertyValue
dim args4(5) as new com.sun.star.beans.PropertyValue
dim lSelect(1) as long

document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

args1(0).Name = "ToPoint"
args1(0).Value = "$Feuille1.$C$5:$G$5"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())

oSheet = thiscomponent.sheets.getByName("Feuil2")
lSelect(0) = oSheet.rangeAddress.sheet
oSheet = thiscomponent.sheets.getByName("Feuil3")
lSelect(1) = oSheet.rangeAddress.sheet

args1(0).Name = "Tables"
args1(0).Value = lSelect()

dispatcher.executeDispatch(document, ".uno:SelectTables", "", 0, args1())

args1(0).Name = "ToPoint"
args1(0).Value = "$Feuil2.$B$4"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
args4(0).Name = "Flags"
args4(0).Value = "A"
args4(1).Name = "FormulaCommand"
args4(1).Value = 0
args4(2).Name = "SkipEmptyCells"
args4(2).Value = false
args4(3).Name = "Transpose"
args4(3).Value = true
args4(4).Name = "AsLink"
args4(4).Value = false
args4(5).Name = "MoveMode"
args4(5).Value = 4

dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args4())

End sub

Voir SelectPlusieursFeuilles.ods

Cordialement