Vba dans vba

Résolu/Fermé
titi17-08 Messages postés 117 Date d'inscription mercredi 29 janvier 2020 Statut Membre Dernière intervention 20 janvier 2023 - 3 sept. 2021 à 08:43
titi17-08 Messages postés 117 Date d'inscription mercredi 29 janvier 2020 Statut Membre Dernière intervention 20 janvier 2023 - 7 oct. 2021 à 22:40
Bonjour Cher forum,
voila je souhaite dans mon code créer des nouvelles feuilles en automatisation.
jusque la ca va ... maintenant je souhaite faire comme le film Inception;)
je voudrais inclure un code vba dans cette feuille créée mais pas physiquement créée
avez vous des idées ?
Merci a vous
belle journée
titi

2 réponses

cs_Le Pivert Messages postés 7904 Date d'inscription jeudi 13 septembre 2007 Statut Contributeur Dernière intervention 14 août 2024 729
3 sept. 2021 à 11:17
Bonjour,

voir ceci:

https://silkyroad.developpez.com/VBA/VisualBasicEditor/#LIV-A

un exemple de ce que l'on peut faire :

Sub creer_macro() ' créer feuille avec macro
'http://silkyroad.developpez.com/VBA/VisualBasicEditor/#LIV-A
Dim Code$, NextLine&
Sheets.Add.Move After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = "mononglet"
  ' Comment ajouter le code.
    Code = "Private Sub Worksheet_SelectionChange(ByVal Target As Range)" & vbCrLf
    Code = Code & "If Not Application.Intersect(Target, Range(""C1:Z100"")) Is Nothing Then" & vbCrLf
    Code = Code & "MsgBox ""Double cliquez en colonnes A et B""" & vbCrLf
    Code = Code & "End If" & vbCrLf
    Code = Code & "End Sub" & vbCrLf
    Code = Code & "Private Sub WorkSheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)" & vbCrLf
    Code = Code & "With Target" & vbCrLf
    Code = Code & "If .Column = 1 Then .Value = Date: Cancel = True" & vbCrLf
    Code = Code & "End With" & vbCrLf
    Code = Code & "With Target" & vbCrLf
    Code = Code & "If .Column = 2 Then .Value = Time: Cancel = True" & vbCrLf
    Code = Code & " End With" & vbCrLf
    Code = Code & "End Sub"
'   Ecriture du code dans le module de la feuille (fs)
With ActiveWorkbook.VBProject.VBComponents(Sheets(Sheets.Count).CodeName).CodeModule
       NextLine = .CountOfLines + 1
      .InsertLines NextLine, Code
End With
End Sub


voilà, à adapter

2
titi17-08 Messages postés 117 Date d'inscription mercredi 29 janvier 2020 Statut Membre Dernière intervention 20 janvier 2023 1
3 sept. 2021 à 19:12
Bonsoir Le Pivert,
je te remercie pour cet exemple qui me va tout a fait.
je vais étudier le Bazard...
Merci
0
titi17-08 Messages postés 117 Date d'inscription mercredi 29 janvier 2020 Statut Membre Dernière intervention 20 janvier 2023 1
6 oct. 2021 à 23:17
Bonsoir Le Pivert,
je reviens vers vous car j'ai travaillé sur le code
bon j'ai une erreur 9 indice en dehors du tableau..
je écris quoi comme bêtise .....? ;)))
Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = MonthName(1) & " " & rep
Dim Code$, NextLine&
Code = "Private Sub test()" & vbCrLf
Code = Code & "If cells(7,2).value<> "" then" & vbCrLf
Code = Code & "Msgbox (1) " & vbCrLf
Code = Code & "End if" & vbCrLf
Code = Code & "End sub"
With ActiveWorkbook.VBProject.VBComponents(Worksheets(MonthName(1) & " " & rep).CodeName).CodeModule
NextLine = .CountOfLines + 1
.InsertLines NextLine, Code
End With
With Sheets(MonthName(1) & " " & rep)
Call conception_feuille
.Tab.Color = RGB(228, 238, 221)

End With


merci par avance
Titi
0
cs_Le Pivert Messages postés 7904 Date d'inscription jeudi 13 septembre 2007 Statut Contributeur Dernière intervention 14 août 2024 729 > titi17-08 Messages postés 117 Date d'inscription mercredi 29 janvier 2020 Statut Membre Dernière intervention 20 janvier 2023
7 oct. 2021 à 10:54
Comme ceci

Sub creer_macro_2() ' créer feuille avec macro
Dim Code$, NextLine&
Dim rep 'donner valeur à cette variable
Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = MonthName(1) & " " & rep
Code = "Private Sub test()" & vbCrLf
        Code = Code & "If cells(7,2).value<> "" "" then" & vbCrLf  'doubler les guillemets
        Code = Code & "Msgbox (1) " & vbCrLf
        Code = Code & "End If" & vbCrLf
        Code = Code & "End sub"
With ActiveWorkbook.VBProject.VBComponents(Worksheets(MonthName(1) & " " & rep).CodeName).CodeModule
       NextLine = .CountOfLines + 1
      .InsertLines NextLine, Code
End With
With Sheets(MonthName(1) & " " & rep)
Call conception_feuille
.Tab.Color = RGB(228, 238, 221)
End With
End Sub


@+ Le Pivert
0
titi17-08 Messages postés 117 Date d'inscription mercredi 29 janvier 2020 Statut Membre Dernière intervention 20 janvier 2023 1 > cs_Le Pivert Messages postés 7904 Date d'inscription jeudi 13 septembre 2007 Statut Contributeur Dernière intervention 14 août 2024
7 oct. 2021 à 21:40
Bonsoir cs_Le Pivert
la subtilité des doubles guillemets ...
pour la valeur de la variable rep elle est plus haut dans le code.
Merci beaucoup je vous tiens au courant
Belle soirée
Titi
0
titi17-08 Messages postés 117 Date d'inscription mercredi 29 janvier 2020 Statut Membre Dernière intervention 20 janvier 2023 1 > cs_Le Pivert Messages postés 7904 Date d'inscription jeudi 13 septembre 2007 Statut Contributeur Dernière intervention 14 août 2024
7 oct. 2021 à 22:16
Re,
j'ai toujours mon erreur 9 indice en dehors de mon tableau et surligner sur le with activeworkbook..
voici le code complet
Sub Creation_Calendrier()
Dim rep As String
Dim Chemin As String
Dim mois As String
rep = InputBox("Quelle année d'exercice?")
cemin = "/Users/thierrydenis/Documents/perso thierry/dossier lionne vba/"
Worksheets(Array("Consolidé", "Factures Réalisées", "Facturation", "Contrat Modele")).Copy
ActiveWorkbook.SaveAs FileName:=cemin & "Exercice SJT-C " & rep & ".xlsm", FileFormat:=52
'Workbooks("Exercice SJT-C " & rep).Activate
Worksheets("Consolidé").Select
'recap effectué
Cells(2, 2).Value = MonthName(1) & " " & rep
Cells(2, 6).Value = MonthName(2) & " " & rep
Cells(2, 10).Value = MonthName(3) & " " & rep
Cells(2, 14).Value = MonthName(4) & " " & rep
Cells(2, 18).Value = MonthName(5) & " " & rep
Cells(2, 22).Value = MonthName(6) & " " & rep
Cells(2, 26).Value = MonthName(7) & " " & rep
Cells(2, 30).Value = MonthName(8) & " " & rep
Cells(2, 34).Value = MonthName(9) & " " & rep
Cells(2, 38).Value = MonthName(10) & " " & rep
Cells(2, 42).Value = MonthName(11) & " " & rep
Cells(2, 46).Value = MonthName(12) & " " & rep
Cells(2, 50).Value = "Totaux " + rep
mois = Cells(2, 2).Value
'recap previsionnel
Cells(9, 2).Value = "Prévi Contrat comm " & MonthName(1) & " " & rep
Cells(9, 6).Value = "Prévi Contrat comm " & MonthName(2) & " " & rep
Cells(9, 10).Value = "Prévi Contrat comm " & MonthName(3) & " " & rep
Cells(9, 14).Value = "Prévi Contrat comm " & MonthName(4) & " " & rep
Cells(9, 18).Value = "Prévi Contrat comm " & MonthName(5) & " " & rep
Cells(9, 22).Value = "Prévi Contrat comm " & MonthName(6) & " " & rep
Cells(9, 26).Value = "Prévi Contrat comm " & MonthName(7) & " " & rep
Cells(9, 30).Value = "Prévi Contrat comm " & MonthName(8) & " " & rep
Cells(9, 34).Value = "Prévi Contrat comm " & MonthName(9) & " " & rep
Cells(9, 38).Value = "Prévi Contrat comm " & MonthName(10) & " " & rep
Cells(9, 42).Value = "Prévi Contrat comm " & MonthName(11) & " " & rep
Cells(9, 46).Value = "Prévi Contrat comm " & MonthName(12) & " " & rep
Cells(9, 50).Value = "Totaux " + rep
Cells(35, 2).Value = "Total Facturé exercice " & rep
'Workbooks("Exercice SJT-C " + rep).Activate
Worksheets("Factures Réalisées").Activate

Cells(2, 2).Value = "Factures Enregistrées " & rep

Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = MonthName(1) & " " & rep
Dim Code$, NextLine&
Code = "Private Sub test()" & vbCrLf
Code = Code & "If cells(7,2).value<> "" "" then" & vbCrLf
Code = Code & "Msgbox (1) " & vbCrLf
Code = Code & "End if" & vbCrLf
Code = Code & "End sub"
With ActiveWorkbook.VBProject.VBComponents(Worksheets(MonthName(1) & " " & rep).CodeName).CodeModule
NextLine = .CountOfLines + 1
.InsertLines NextLine, Code
End With
With Sheets(MonthName(1) & " " & rep)
Call conception_feuille
.Tab.Color = RGB(228, 238, 221)

End With
Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = MonthName(2) & " " & rep
With Sheets(MonthName(2) & " " & rep)
Call conception_feuille
.Tab.Color = RGB(253, 242, 208)
End With
Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = MonthName(3) & " " & rep

Code = "Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)" & vbCrLf
Code = Code & "Dim Nomfiche As String" & vbCrLf
Code = Code & "Nomfiche = Cells(7, 2).Value" & vbCrLf
Code = Code & "If Not Application.Intersect(Target, Cells(7, 2)) Is Nothing Then" & vbCrLf
Code = Code & "Worksheets(""Contrat ""& Nomfiche).Visible = True 'Rend feuille visible" & vbCrLf
Code = Code & "Worksheets(""Contrat "" & Nomfiche).Activate" & vbCrLf
Code = Code & "End If" & vbCrLf
Code = Code & "End Sub" & vbCrLf
With ActiveWorkbook.VBProject.VBComponents(Worksheets(MonthName(3) & " " & rep).CodeName).CodeModule
NextLine = .CountOfLines + 1
.InsertLines NextLine, Code
End With

With Sheets(MonthName(3) & " " & rep)
Call conception_feuille
.Tab.Color = RGB(228, 238, 221)
End With
Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = MonthName(4) & " " & rep
With Sheets(MonthName(4) & " " & rep)
Call conception_feuille
.Tab.Color = RGB(253, 242, 208)
End With
Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = MonthName(5) & " " & rep
With Sheets(MonthName(5) & " " & rep)
Call conception_feuille
.Tab.Color = RGB(228, 238, 221)
End With
Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = MonthName(6) & " " & rep
With Sheets(MonthName(6) & " " & rep)
Call conception_feuille
.Tab.Color = RGB(253, 242, 208)
End With
Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = MonthName(7) & " " & rep
With Sheets(MonthName(7) & " " & rep)
Call conception_feuille
.Tab.Color = RGB(228, 238, 221)
End With
Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = MonthName(8) & " " & rep
With Sheets(MonthName(8) & " " & rep)
Call conception_feuille
.Tab.Color = RGB(253, 242, 208)
End With
Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = MonthName(9) & " " & rep
With Sheets(MonthName(9) & " " & rep)
Call conception_feuille
.Tab.Color = RGB(228, 238, 221)
End With
Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = MonthName(10) & " " & rep
With Sheets(MonthName(10) & " " & rep)
Call conception_feuille
.Tab.Color = RGB(253, 242, 208)
End With
Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = MonthName(11) & " " & rep
With Sheets(MonthName(11) & " " & rep)
Call conception_feuille
.Tab.Color = RGB(228, 238, 221)
End With
Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = MonthName(12) & " " & rep
With Sheets(MonthName(12) & " " & rep)
Call conception_feuille
.Tab.Color = RGB(253, 242, 208)
End With
Sheets("Consolidé").Select
'Totaux Freelance
Cells(5, 2).Formula = "='" & MonthName(1) & " " & rep & "'!R[3]C[23]"
Cells(5, 3).Formula = "='" & MonthName(1) & " " & rep & "'!R[3]C[23]"
Cells(5, 4).Formula = "='" & MonthName(1) & " " & rep & "'!R[3]C[23]"

Cells(5, 6).Formula = "='" & MonthName(2) & " " & rep & "'!R[3]C[19]"
Cells(5, 7).Formula = "='" & MonthName(2) & " " & rep & "'!R[3]C[19]"
Cells(5, 8).Formula = "='" & MonthName(2) & " " & rep & "'!R[3]C[19]"

Cells(5, 10).Formula = "='" & MonthName(3) & " " & rep & "'!R[3]C[15]"
Cells(5, 11).Formula = "='" & MonthName(3) & " " & rep & "'!R[3]C[15]"
Cells(5, 12).Formula = "='" & MonthName(3) & " " & rep & "'!R[3]C[15]"

Cells(5, 14).Formula = "='" & MonthName(4) & " " & rep & "'!R[3]C[11]"
Cells(5, 15).Formula = "='" & MonthName(4) & " " & rep & "'!R[3]C[11]"
Cells(5, 16).Formula = "='" & MonthName(4) & " " & rep & "'!R[3]C[11]"

Cells(5, 18).Formula = "='" & MonthName(5) & " " & rep & "'!R[3]C[7]"
Cells(5, 19).Formula = "='" & MonthName(5) & " " & rep & "'!R[3]C[7]"
Cells(5, 20).Formula = "='" & MonthName(5) & " " & rep & "'!R[3]C[7]"

Cells(5, 22).Formula = "='" & MonthName(6) & " " & rep & "'!R[3]C[3]"
Cells(5, 23).Formula = "='" & MonthName(6) & " " & rep & "'!R[3]C[3]"
Cells(5, 24).Formula = "='" & MonthName(6) & " " & rep & "'!R[3]C[3]"

Cells(5, 26).Formula = "='" & MonthName(7) & " " & rep & "'!R[3]C[-1]"
Cells(5, 27).Formula = "='" & MonthName(7) & " " & rep & "'!R[3]C[-1]"
Cells(5, 28).Formula = "='" & MonthName(7) & " " & rep & "'!R[3]C[-1]"

Cells(5, 30).Formula = "='" & MonthName(8) & " " & rep & "'!R[3]C[-5]"
Cells(5, 31).Formula = "='" & MonthName(8) & " " & rep & "'!R[3]C[-5]"
Cells(5, 32).Formula = "='" & MonthName(8) & " " & rep & "'!R[3]C[-5]"

Cells(5, 34).Formula = "='" & MonthName(9) & " " & rep & "'!R[3]C[-9]"
Cells(5, 35).Formula = "='" & MonthName(9) & " " & rep & "'!R[3]C[-9]"
Cells(5, 36).Formula = "='" & MonthName(9) & " " & rep & "'!R[3]C[-9]"

Cells(5, 38).Formula = "='" & MonthName(10) & " " & rep & "'!R[3]C[-13]"
Cells(5, 39).Formula = "='" & MonthName(10) & " " & rep & "'!R[3]C[-13]"
Cells(5, 40).Formula = "='" & MonthName(10) & " " & rep & "'!R[3]C[-13]"

Cells(5, 42).Formula = "='" & MonthName(11) & " " & rep & "'!R[3]C[-17]"
Cells(5, 43).Formula = "='" & MonthName(11) & " " & rep & "'!R[3]C[-17]"
Cells(5, 44).Formula = "='" & MonthName(11) & " " & rep & "'!R[3]C[-17]"

Cells(5, 46).Formula = "='" & MonthName(12) & " " & rep & "'!R[3]C[-21]"
Cells(5, 47).Formula = "='" & MonthName(12) & " " & rep & "'!R[3]C[-21]"
Cells(5, 48).Formula = "='" & MonthName(12) & " " & rep & "'!R[3]C[-21]"

'Totaux Recrutement
Cells(7, 2).Formula = "='" & MonthName(1) & " " & rep & "'!R[5]C[15]"
Cells(7, 3).Formula = "='" & MonthName(1) & " " & rep & "'!R[5]C[15]"
Cells(7, 4).Formula = "='" & MonthName(1) & " " & rep & "'!R[5]C[15]"

Cells(7, 6).Formula = "='" & MonthName(2) & " " & rep & "'!R[5]C[11]"
Cells(7, 7).Formula = "='" & MonthName(2) & " " & rep & "'!R[5]C[11]"
Cells(7, 8).Formula = "='" & MonthName(2) & " " & rep & "'!R[5]C[11]"

Cells(7, 10).Formula = "='" & MonthName(3) & " " & rep & "'!R[5]C[7]"
Cells(7, 11).Formula = "='" & MonthName(3) & " " & rep & "'!R[5]C[7]"
Cells(7, 12).Formula = "='" & MonthName(3) & " " & rep & "'!R[5]C[7]"

Cells(7, 14).Formula = "='" & MonthName(4) & " " & rep & "'!R[5]C[3]"
Cells(7, 15).Formula = "='" & MonthName(4) & " " & rep & "'!R[5]C[3]"
Cells(7, 16).Formula = "='" & MonthName(4) & " " & rep & "'!R[5]C[3]"

Cells(7, 18).Formula = "='" & MonthName(5) & " " & rep & "'!R[5]C[-1]"
Cells(7, 19).Formula = "='" & MonthName(5) & " " & rep & "'!R[5]C[-1]"
Cells(7, 20).Formula = "='" & MonthName(5) & " " & rep & "'!R[5]C[-1]"

Cells(7, 22).Formula = "='" & MonthName(6) & " " & rep & "'!R[5]C[-5]"
Cells(7, 23).Formula = "='" & MonthName(6) & " " & rep & "'!R[5]C[-5]"
Cells(7, 24).Formula = "='" & MonthName(6) & " " & rep & "'!R[5]C[-5]"

Cells(7, 26).Formula = "='" & MonthName(7) & " " & rep & "'!R[5]C[-9]"
Cells(7, 27).Formula = "='" & MonthName(7) & " " & rep & "'!R[5]C[-9]"
Cells(7, 28).Formula = "='" & MonthName(7) & " " & rep & "'!R[5]C[-9]"

Cells(7, 30).Formula = "='" & MonthName(8) & " " & rep & "'!R[5]C[-13]"
Cells(7, 31).Formula = "='" & MonthName(8) & " " & rep & "'!R[5]C[-13]"
Cells(7, 32).Formula = "='" & MonthName(8) & " " & rep & "'!R[5]C[-13]"

Cells(7, 34).Formula = "='" & MonthName(9) & " " & rep & "'!R[5]C[-17]"
Cells(7, 35).Formula = "='" & MonthName(9) & " " & rep & "'!R[5]C[-17]"
Cells(7, 36).Formula = "='" & MonthName(9) & " " & rep & "'!R[5]C[-17]"

Cells(7, 38).Formula = "='" & MonthName(10) & " " & rep & "'!R[5]C[-21]"
Cells(7, 39).Formula = "='" & MonthName(10) & " " & rep & "'!R[5]C[-21]"
Cells(7, 40).Formula = "='" & MonthName(10) & " " & rep & "'!R[5]C[-21]"

Cells(7, 42).Formula = "='" & MonthName(11) & " " & rep & "'!R[5]C[-25]"
Cells(7, 43).Formula = "='" & MonthName(11) & " " & rep & "'!R[5]C[-25]"
Cells(7, 44).Formula = "='" & MonthName(11) & " " & rep & "'!R[5]C[-25]"

Cells(7, 46).Formula = "='" & MonthName(12) & " " & rep & "'!R[5]C[-29]"
Cells(7, 47).Formula = "='" & MonthName(12) & " " & rep & "'!R[5]C[-29]"
Cells(7, 48).Formula = "='" & MonthName(12) & " " & rep & "'!R[5]C[-29]"

'Totaux Prévisionnel
Cells(12, 2).Formula = "='" & MonthName(1) & " " & rep & "'!R[-4]C[11]"
Cells(12, 3).Formula = "='" & MonthName(1) & " " & rep & "'!R[-4]C[11]"
'Cells(12, 4).Formula = "='" & MonthName(1) & " " & rep & "'!R[-3]C[14]"

Cells(12, 6).Formula = "='" & MonthName(2) & " " & rep & "'!R[-4]C[7]"
Cells(12, 7).Formula = "='" & MonthName(2) & " " & rep & "'!R[-4]C[7]"
'Cells(12, 8).Formula = "='" & MonthName(2) & " " & rep & "'!R[]C[11]"

Cells(12, 10).Formula = "='" & MonthName(3) & " " & rep & "'!R[-4]C[3]"
Cells(12, 11).Formula = "='" & MonthName(3) & " " & rep & "'!R[-4]C[3]"
'Cells(12, 12).Formula = "='" & MonthName(3) & " " & rep & "'!R[5]C[7]"

Cells(12, 14).Formula = "='" & MonthName(4) & " " & rep & "'!R[-4]C[-1]"
Cells(12, 15).Formula = "='" & MonthName(4) & " " & rep & "'!R[-4]C[-1]"
'Cells(12, 16).Formula = "='" & MonthName(4) & " " & rep & "'!R[5]C[3]"

Cells(12, 18).Formula = "='" & MonthName(5) & " " & rep & "'!R[-4]C[-5]"
Cells(12, 19).Formula = "='" & MonthName(5) & " " & rep & "'!R[-4]C[-5]"
'Cells(12, 20).Formula = "='" & MonthName(5) & " " & rep & "'!R[5]C[-1]"

Cells(12, 22).Formula = "='" & MonthName(6) & " " & rep & "'!R[-4]C[-9]"
Cells(12, 23).Formula = "='" & MonthName(6) & " " & rep & "'!R[-4]C[-9]"
'Cells(12, 24).Formula = "='" & MonthName(6) & " " & rep & "'!R[5]C[-5]"

Cells(12, 26).Formula = "='" & MonthName(7) & " " & rep & "'!R[-4]C[-13]"
Cells(12, 27).Formula = "='" & MonthName(7) & " " & rep & "'!R[-4]C[-13]"
'Cells(12, 28).Formula = "='" & MonthName(7) & " " & rep & "'!R[-3]C[-9]"

Cells(12, 30).Formula = "='" & MonthName(8) & " " & rep & "'!R[-4]C[-17]"
Cells(12, 31).Formula = "='" & MonthName(8) & " " & rep & "'!R[-4]C[-17]"
'Cells(12, 32).Formula = "='" & MonthName(8) & " " & rep & "'!R[5]C[-13]"

Cells(12, 34).Formula = "='" & MonthName(9) & " " & rep & "'!R[-4]C[-21]"
Cells(12, 35).Formula = "='" & MonthName(9) & " " & rep & "'!R[-4]C[-21]"
'Cells(12, 36).Formula = "='" & MonthName(9) & " " & rep & "'!R[5]C[-17]"

Cells(12, 38).Formula = "='" & MonthName(10) & " " & rep & "'!R[-4]C[-25]"
Cells(12, 39).Formula = "='" & MonthName(10) & " " & rep & "'!R[-4]C[-25]"
'Cells(12, 40).Formula = "='" & MonthName(10) & " " & rep & "'!R[5]C[-21]"

Cells(12, 42).Formula = "='" & MonthName(11) & " " & rep & "'!R[-4]C[-29]"
Cells(12, 43).Formula = "='" & MonthName(11) & " " & rep & "'!R[-4]C[-29]"
'Cells(12, 44).Formula = "='" & MonthName(11) & " " & rep & "'!R[5]C[-25]"

Cells(12, 46).Formula = "='" & MonthName(12) & " " & rep & "'!R[-4]C[-33]"
Cells(12, 47).Formula = "='" & MonthName(12) & " " & rep & "'!R[-4]C[-33]"
'Cells(12, 48).Formula = "='" & MonthName(12) & " " & rep & "'!R[5]C[-29]"

MsgBox ("Votre Classeur est prêt, bon exercice ;)")
'ChDir "C:\Users\Sandrine\Desktop\PERSO\SOCIETE\Suivi SJTC"
End Sub

0
eriiic Messages postés 24597 Date d'inscription mardi 11 septembre 2007 Statut Contributeur Dernière intervention 22 septembre 2024 7 235
3 sept. 2021 à 13:28
Bonjour,

si ton code est toujours le même, le plus simple est de créer une feuille modèle avec le code, feuille que tu dupliques.
eric
0
titi17-08 Messages postés 117 Date d'inscription mercredi 29 janvier 2020 Statut Membre Dernière intervention 20 janvier 2023 1
3 sept. 2021 à 19:15
Bonjour Eric,
c'est une solution en effet, avoir comment je vais articuler la création des feuilles et les besoins.
Merci a vous deux en tout cas
A +
Thierry
0