Bonjour,
J'essaie de créer une fonction me permettant de créer automatiquement des fiches, à partir d'un modèle et d'une feuille (BD) dans laquelle serait regroupé toutes mes infos. Or, je ne trouve pas pourquoi ma fonction ne marche pas, il y a toujours le même messager d'erreur : "erreur 1004 : La méthode Copy de la classe Range a échoué"... n'étant pas expert (loin de la) j'aimerais savoir si vous pouviez m'aider ?
la fonction en question :
Sub CreeOnglets()
Application.ScreenUpdating = False
supOnglets
Set bd = Sheets("bd")
bd.[A1].CurrentRegion.Sort Key1:=bd.Range("A2"), Order1:=xlAscending, Header:=xlGuess
ligBD = 2
Do While ligBD <= bd.[A65000].End(xlUp).Row
nom = bd.Cells(ligBD, 1) ' Premier nom
Sheets("modèle").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = "Fiche " & nom
Set fiche = Sheets("Fiche " & nom)
fiche.Range("B2").Value = nom
fiche.Range("b3").Value = bd.Cells(ligBD, "B")
fiche.Range("b4").Value = bd.Cells(ligBD, "C")
fiche.Range("b7").Value = bd.Cells(ligBD, "D")
fiche.Range("b8").Value = bd.Cells(ligBD, "E")
fiche.Range("b9").Value = bd.Cells(ligBD, "F")
fiche.Range("b10").Value = bd.Cells(ligBD, "G")
fiche.Range("b11").Value = bd.Cells(ligBD, "H")
fiche.Range("f7").Value = bd.Cells(ligBD, "I")
fiche.Range("f8").Value = bd.Cells(ligBD, "J")
fiche.Range("f9").Value = bd.Cells(ligBD, "K")
fiche.Range("a14").Value = bd.Cells(ligBD, "L")
bd.Cells(ligBD, "L").Copy fiche.Range("a14")
ligBD = ligBD + 1
Loop
End Sub
Merci de votre retour !