Bonsoir,
La macro est toute simple.
Elle sélectionne les cellules A6 à J6.
Insère des cellules en déplaçant les cellules vers le bas.
elle sélectionne les cellules A7 jusqu'à J8.
recopie ces cellules sur A6 à j6.
Je joins un petit fichier
voici la macro :
Code : Tout sélectionner
REM ***** BASIC *****
Sub Main
End Sub
sub Enrg_Pds_Jour_L
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$A$5:$J$5"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Flags"
args2(0).Value = "V"
dispatcher.executeDispatch(document, ".uno:InsertCell", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "ToPoint"
args3(0).Value = "$A$6:$J$7"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args3())
rem ----------------------------------------------------------------------
dim args4(0) as new com.sun.star.beans.PropertyValue
args4(0).Name = "EndCell"
args4(0).Value = "$J$5"
dispatcher.executeDispatch(document, ".uno:AutoFill", "", 0, args4())
rem ----------------------------------------------------------------------
dim args5(0) as new com.sun.star.beans.PropertyValue
args5(0).Name = "ToPoint"
args5(0).Value = "$A$5:$J$7"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args5())
end sub
sub Enrg_Pds_Jour_D
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$A$6:$J$6"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Flags"
args2(0).Value = "V"
dispatcher.executeDispatch(document, ".uno:InsertCell", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "ToPoint"
args3(0).Value = "$A$7:$J$8"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args3())
rem ----------------------------------------------------------------------
dim args4(0) as new com.sun.star.beans.PropertyValue
args4(0).Name = "EndCell"
args4(0).Value = "$J$6"
dispatcher.executeDispatch(document, ".uno:AutoFill", "", 0, args4())
rem ----------------------------------------------------------------------
dim args5(0) as new com.sun.star.beans.PropertyValue
args5(0).Name = "ToPoint"
args5(0).Value = "$A$6:$J$8"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args5())
end sub
Vous ne pouvez pas consulter les pièces jointes insérées à ce message.
AOO4114m1(Build:9811) - Rev. a0d24fb625
2023-02-08 19:47
Windows 11 Famille
Version : 22H2