Bonjours,
J'ai installé une macro afin que lorsque par exemple j'écris qu'il y a 3 piézomètres il me mettent 3 fiche terrains près rempli. le problème c'est que lorsque j'écris la macro sur toute mes fiches terrains crée il affiche "nombre de prestation 1" etc .
Voici la marco :
Option Explicit
Const FA = "Accueil"
Const CelPrest = "B2"
Const FM = "Modele"
Const celnuPrest = "A1"
Const FP = "Prestation n° "
Public Sub OK()
Dim nbprest As Long, nuprest As Long
nbprest = Sheets(FA).Range(CelPrest).Value
If nbprest = 0 Then Exit Sub
For nuprest = 1 To nbprest
Sheets(FM).Copy after:=Sheets(Sheets.Count)
ActiveSheet.Name = FP & nuprest
ActiveSheet.Range(celnuPrest).Value = FP & nuprest
Next nuprest
Sheets(FA).Select
End Sub
Public Sub RAZ()
Dim nbprest As Long, nuprest As Long
nbprest = Sheets.Count
If nbprest <= 2 Then Exit Sub
If MsgBox("Supprimer les feuilles Prestation", vbYesNo) = vbNo Then Exit Sub
Application.DisplayAlerts = False
For nuprest = nbprest To 1 Step -1
If InStr(1, Sheets(nuprest).Name, FP) > 0 Then Sheets(nuprest).Delete
Next nuprest
Application.DisplayAlerts = True
End Sub
merci de m'aider !
cordialement honnoe