Sub ajout_feuille()
Dim Nom As String, i As Byte, Verif As Boolean
recom:
Verif = False
Nom = InputBox("Définissez le nom de votre nouvelle feuille", "Ajout nouvelle feuille")
If Nom = "" Then Exit Sub
For i = 1 To Sheets.Count
If Sheets(i).Name = Nom Then Verif = True
Next
If Verif = True Then
MsgBox "la feuille " & Nom & " existe déjà, veuillez choisir un autre nom"
GoTo recom
End If
Sheets.Add(after:=Sheets(Sheets.Count)).Name = Nom
End Sub
Nom$ = Application.WorksheetFunction.IsoWeekNum(Date)
'Si l'onglet existe déjà, il n'est pas créé
Function FeuilleExiste(Nom As String) As Boolean
On Error Resume Next
FeuilleExiste = Sheets(Nom).Name <> ""
On Error GoTo 0
End Function
Sub CreationOngletIndividuel()
Application.ScreenUpdating = False
Application.EnableEvents = False
Nom$ = Application.WorksheetFunction.IsoWeekNum(Date)
For Each ws In Worksheets
If ws.Name = Nom Then MsgBox "La feuille existe déjà": Exit Sub: Application.EnableEvents = True
Next ws
If Nom = "" Or Nom Like "*[-./\#[?!()']*" Or Len(Nom) > 30 Then
MsgBox "le nom n'est pas valide": Application.EnableEvents = True: Exit Sub
End If
Sheets("Test").Copy After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = Nom
End Sub
Bonsoirbonsoir le fil, re celtar
un petit peu comme jbarbe, mais avec le nom défini par le numéro de semaine
cdtVB:'Si l'onglet existe déjà, il n'est pas créé Function FeuilleExiste(Nom As String) As Boolean On Error Resume Next FeuilleExiste = Sheets(Nom).Name <> "" On Error GoTo 0 End Function Sub CreationOngletIndividuel() Application.ScreenUpdating = False Application.EnableEvents = False Nom$ = Application.WorksheetFunction.IsoWeekNum(Date) For Each ws In Worksheets If ws.Name = Nom Then MsgBox "La feuille existe déjà": Exit Sub: Application.EnableEvents = True Next ws If Nom = "" Or Nom Like "*[-./\#[?!()']*" Or Len(Nom) > 30 Then MsgBox "le nom n'est pas valide": Application.EnableEvents = True: Exit Sub End If Sheets("Test").Copy After:=Sheets(Sheets.Count) Sheets(Sheets.Count).Name = Nom End Sub
Bonjour Désolé voila le fichier deverouilléBonsoir le forum
Bonsoir celtar, JBARBE, GALOUGALOU
Si en plus pour "tenter" (je parle pour moi) de t'aider, il faut "casser" le password du projet VBE......
Bonne soirée à toutes & à tous
@+ Eric c
'Si l'onglet existe déjà, il n'est pas créé
Function FeuilleExiste(Nom As String) As Boolean
On Error Resume Next
FeuilleExiste = Sheets(Nom).Name <> ""
On Error GoTo 0
End Function
Sub CreationOngletIndividuel()
Application.ScreenUpdating = False
Application.EnableEvents = False
Nom$ = Application.WorksheetFunction.IsoWeekNum(Date)
For Each ws In Worksheets
If ws.Name = Nom Then MsgBox "La feuille existe déjà": Exit Sub: Application.EnableEvents = True
Next ws
If Nom = "" Or Nom Like "*[-./\#[?!()']*" Or Len(Nom) > 30 Then
MsgBox "le nom n'est pas valide": Application.EnableEvents = True: Exit Sub
End If
Sheets("Récapitulatif").Copy After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = Nom
End Sub
Function NumSem(dDate As Date) As Integer
Dim t As Long
t = DateSerial(Year(dDate + (8 - Weekday(dDate)) Mod 7 - 3), 1, 1)
NumSem = ((dDate - t - 3 + (Weekday(t) + 1) Mod 7)) \ 7 + 1
End Function
Nom$ = Application.WorksheetFunction.IsoWeekNum(Date)
Nom$ = NumSem(Date)
Nom$ = "Semaine" & " " & DatePart("WW", Date, 2, 2)
' Sheets("Test").Copy remplacé par :
Sheets("Récapitulatif").Copy After:=Sheets(Sheets.Count)
Bonjour,Re le forum
Re le fil
@GALOUGALOU (comme je ne connais pas ton prénom).
Le code du projet "craqué" que notre ami ne nous a pas communiqué est : "123".
Concernant ton code, je vais tester dès ce soir.
Le tien, modifié :
Bonne après-midi à toutes & à tous --- Gardez le frais si possible --VB:Nom$ = "Semaine" & " " & DatePart("WW", Date, 2, 2) ' Sheets("Test").Copy remplacé par : Sheets("Récapitulatif").Copy After:=Sheets(Sheets.Count)
@+ Eric c
Désolé je l'ai supprimé les autres sont déverrouillé grâce a toi.Re le fil
@celtar : Ouvre Ton fichier du post #7, fais Alt F11 et tu verras que ton projet est verrouillé ..............
@+
Et oui, je sais, je suis incognito, les amis me surnomment jeff, ça me convient.(comme je ne connais pas ton prénom).