XL 2013 demande d'aide vba

bredeche

XLDnaute Occasionnel
bonjour mon problème est sur la création d'onglet la macro me produit 3 onglet et mes données ne s'enregistrent pas dans la fiche et mon second problème est quand je réalise la deuxième fiche
ci dessous mon code
merci de votre aide
je peux vous joindre mon fichier sur demande
cordialement

VB:
Private Sub CommandButton2_Click() 'Bouton VALIDER
Dim NewLig As Long
Dim c As Range

    With Sheets("Recap")
        NewLig = Application.Max(10, .Range("A" & Rows.Count).End(xlUp).Row + 1)
        .Range("A" & NewLig).Value = Application.WorksheetFunction.Max(Range("A:A")) + 1
        .Range("C" & NewLig).Value = TextBoxobjet
        .Range("Y" & NewLig).Value = ComboBox4
        .Range("Z" & NewLig).Value = TextBoxfiche
        .Range("AA" & NewLig).Value = CDate(TextBoxdate)
        .Range("AB" & NewLig).Value = TextBoximputation
        .Range("AC" & NewLig).Value = TextBoxlocalisation
        .Range("AD" & NewLig).Value = ComboBox1
        .Range("D" & NewLig).Value = ComboBox1
        .Range("AE" & NewLig).Value = TextBoxannée
        .Range("AF" & NewLig).Value = CheckBox1
        .Range("AG" & NewLig).Value = CheckBox2
        .Range("AH" & NewLig).Value = CheckBox3
        .Range("AI" & NewLig).Value = TextBoxconstat
        .Range("AJ" & NewLig).Value = TextBoxrisque
        .Range("AK" & NewLig).Value = TextBoxorigine
        .Range("AL" & NewLig).Value = TextBoxconservatoires
        .Range("AM" & NewLig).Value = TextBoxtravaux
        .Range("AN" & NewLig).Value = TextBoxobservation
        .Range("AO" & NewLig).Value = TextBoxconstructeur
        .Range("AP" & NewLig).Value = TextBoxdureevie1
        .Range("AQ" & NewLig).Value = TextBoxdureevie2
        .Range("AR" & NewLig).Value = TextBoximage
    End With
    
   Application.ScreenUpdating = False
    'On crée les onglets qui sont listés à partir de la cellule
    'A2 de l'onglet nommé Liste
    Set c = Worksheets("RECAP").Range("B10") 'cellule de départ
 

        'on copie le modèle en dernier
        Worksheets("TRAME").Copy After:=Worksheets(ThisWorkbook.Sheets.Count)

        With Worksheets(ThisWorkbook.Sheets.Count) 'avec l'onglet créé
            .Name = c.Value    'je renome
            
            'Je remplit mon modèle comme je veut...
            .Range("B3") = TextBoxobjet
              .Range("A6") = TextBoxfiche
                .Range("B6") = TextBoxdate
                 .Range("C6") = TextBoximputation
                  .Range("D6") = TextBoxlocalisation
                   .Range("E6") = ComboBox1
                    .Range("F6") = TextBoxannée
                     .Range("G6") = ComboBox4
                     .Range("A9") = TextBoxconstat
                      .Range("E11") = CheckBox1
                       .Range("E12") = CheckBox2
                        .Range("E13") = CheckBox3
                         .Range("A16") = TextBoxrisque
                          .Range("A21") = TextBoxorigine
                           .Range("A26") = TextBoxconservatoires
                            .Range("A30") = TextBoxtravaux
                             .Range("A35") = TextBoxobservation
                              .Range("H15") = TextBoxconstructeur
                                .Range("K17") = TextBoxdureevie1
                                 .Range("K18") = TextBoxdureevie2
                                  .Range("H20") = TextBoximage

        End With

            Application.ScreenUpdating = True
    
    Unload UserForm1
End Sub
 
C

Compte Supprimé 979

Guest
Bonjour Bredeche,

Sans fichier compliqué
Je peux voir comme ça, que tu ne fais aucune boucle de type For X to Y
Donc je ne vois pas comment tu peux créer plusieurs onglets

A+
 

Statistiques des forums

Discussions
312 188
Messages
2 086 026
Membres
103 099
dernier inscrit
myseb