1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Function Add_sheet(ByVal MySheet As String, Optional Mydel As Boolean) As Boolean
Dim F1 As Worksheet
For Each F1 In Sheets
If F1.Name = MySheet Then
If Mydel Then
F1.Delete
Exit For
End If
MsgBox "La feuille " & F1.Name & " existe déja", vbInformation, "Classeur " & F1.Parent.Name
Exit Function
End If
Next
' ------------------------------- '
' Ajout de l'onglet
' ------------------------------- '
Set F1 = Sheets.Add(After:=Sheets(Sheets.Count))
F1.Name = MySheet
Add_sheet = True
End Function |
Partager