D
Domi
Guest
Bonjour tou le monde !!
J'ai un petit souçi au nivo dune macro qui me sert à copié une feuille nommé "MODELE" et a collé sur une feuille X.
Je mexplique je rentre mé informations sur la feuille modele et grace a une macro je copie celle ci et je la colle sur une otre ! cette otre et ainsi de suite. le probleme c que le je sui arrivé à 30 feuilles et je ne pe pa allé plu loin il me met un message derreur ! y a til une solution ??
JE vou donne a toute fin utile le code VBA :
Sub save()
Sheets("Modele").Activate
If Range("B5").Value = "" Or Range("E5").Value = "" Or Range("E7").Value = "" Or Range("H5").Value = "" Or Range("B7").Value = "" Or Range("H7").Value = "" Or Range("E11").Value = "" Or Range("H11").Value = "" Or Range("K15").Value = "" Or Range("F19").Value = "" Or Range("e23").Value = "" Or Range("d28").Value = "" Then
reponse = MsgBox("Tous les champs sont remplis la peut être ?", vbCritical, "Attention")
Exit Sub
Exit Sub
Else
Sheets("Tableau").Select
Range("A65536").End(xlUp).Offset(1, 0).Select
ActiveCell.Value = Sheets("Modele").Range("B5").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("E5").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("H5").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("H6").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("B7").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("E7").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("H7").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("E11").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("H11").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("a40").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("K15").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("d28").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f29").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f30").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f31").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f32").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f33").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f34").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f35").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f36").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f37").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f38").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f39").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f40").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f41").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f42").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f43").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f44").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f45").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f46").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f47").Value
Range("A3:ae65536").Select
Selection.Sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A1").Select
Sheets("Modele").Select
Range("a1").Select
End If
Set modèle = ThisWorkbook.Worksheets("Modele")
Dim creation
creation = MsgBox("ETES VOUS CERTAINS ?", vbOKCancel)
If creation = vbCancel Then Range("b5").Select Else
If creation = vbOK Then modèle.Copy After:=modèle
ActiveSheet.Name = Range("e11")
Sheets("Modele").Select
Range("E22,B5,E5,H5,h6,B7,H7,E11,f19,H11,K15,g28,c28,d28,k19").Select
Range("D31,a28,a42") = 1
Range("E31,E32,E33,E34,E35,E36,E37,E38,E39,E40,E41,E42,E43,E44,E45,E46,E47,e48,e49,e50,e51,e52") = faux
Selection.ClearContents
Range("a1").Select
Sheets("accueil").Select
Exit Sub
End Sub
J'ai un petit souçi au nivo dune macro qui me sert à copié une feuille nommé "MODELE" et a collé sur une feuille X.
Je mexplique je rentre mé informations sur la feuille modele et grace a une macro je copie celle ci et je la colle sur une otre ! cette otre et ainsi de suite. le probleme c que le je sui arrivé à 30 feuilles et je ne pe pa allé plu loin il me met un message derreur ! y a til une solution ??
JE vou donne a toute fin utile le code VBA :
Sub save()
Sheets("Modele").Activate
If Range("B5").Value = "" Or Range("E5").Value = "" Or Range("E7").Value = "" Or Range("H5").Value = "" Or Range("B7").Value = "" Or Range("H7").Value = "" Or Range("E11").Value = "" Or Range("H11").Value = "" Or Range("K15").Value = "" Or Range("F19").Value = "" Or Range("e23").Value = "" Or Range("d28").Value = "" Then
reponse = MsgBox("Tous les champs sont remplis la peut être ?", vbCritical, "Attention")
Exit Sub
Exit Sub
Else
Sheets("Tableau").Select
Range("A65536").End(xlUp).Offset(1, 0).Select
ActiveCell.Value = Sheets("Modele").Range("B5").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("E5").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("H5").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("H6").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("B7").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("E7").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("H7").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("E11").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("H11").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("a40").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("K15").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("d28").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f29").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f30").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f31").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f32").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f33").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f34").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f35").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f36").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f37").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f38").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f39").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f40").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f41").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f42").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f43").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f44").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f45").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f46").Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Sheets("Modele").Range("f47").Value
Range("A3:ae65536").Select
Selection.Sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A1").Select
Sheets("Modele").Select
Range("a1").Select
End If
Set modèle = ThisWorkbook.Worksheets("Modele")
Dim creation
creation = MsgBox("ETES VOUS CERTAINS ?", vbOKCancel)
If creation = vbCancel Then Range("b5").Select Else
If creation = vbOK Then modèle.Copy After:=modèle
ActiveSheet.Name = Range("e11")
Sheets("Modele").Select
Range("E22,B5,E5,H5,h6,B7,H7,E11,f19,H11,K15,g28,c28,d28,k19").Select
Range("D31,a28,a42") = 1
Range("E31,E32,E33,E34,E35,E36,E37,E38,E39,E40,E41,E42,E43,E44,E45,E46,E47,e48,e49,e50,e51,e52") = faux
Selection.ClearContents
Range("a1").Select
Sheets("accueil").Select
Exit Sub
End Sub