1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
| Private Sub CommandButton9_Click()
Dim Nom As String, i As Byte, Verif As Boolean, myMonth As Integer, myYear As Integer, myDate As Date, ee As String, a As Long
myDate = Date ' enregistre la date d'aujourd'hui dans la variable myDate
myMonth = (Month(myDate)) ' No du mois précédent
myYear = Year(Date) 'No année
ee = ""
recom:
Verif = False
Nom = InputBox("Définissez le nom du nouveau svp", "Ajout nouveau ") & "" & (myMonth) & " - " & myYear
If Nom = "" Then Exit Sub
For i = 1 To Sheets.Count
If Workbooks("AVIONS").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
Workbooks("AVIONS").Sheets.Add(After:=Sheets(Sheets.Count)).Name = Nom
Application.ScreenUpdating = False
Workbooks("AVIONS").Sheets(1).Activate
Range("A1:P3").Select
Selection.Copy
Workbooks("AVIONS").Sheets(Nom).Activate
Range("A1").Select
ActiveSheet.Paste
'On copie colle uniquement le format des colonnes
Workbooks("AVIONS").Sheets(1).Activate
Columns("A:P").Select
Selection.Copy
Workbooks("AVIONS").Sheets(Nom).Activate
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.ScreenUpdating = True
Unload Me
UserForm1.Show
End Sub
Private Sub CommandButton8_Click()
Dim Nom As String, i As Byte, Verif As Boolean, myMonth As Integer, myYear As Integer, myDate As Date, ee As String, a As Long
myDate = Date ' enregistre la date d'aujourd'hui dans la variable myDate
myMonth = (Month(myDate)) ' No du mois précédent
myYear = Year(Date) 'No année
ee = ""
recom:
Verif = False
Nom = InputBox("Définissez le nom du nouveau client svp", "Ajout nouveau client") & "" & (myMonth) & " - " & myYear
If Nom = "" Then Exit Sub
For i = 1 To Sheets.Count
If Workbooks("C-CLIENT").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
Workbooks("C-CLIENT").Sheets.Add(After:=Sheets(Sheets.Count)).Name = Nom
Application.ScreenUpdating = False
Workbooks("C-CLIENT").Sheets(1).Activate
Range("A1:Q3").Select
Selection.Copy
Workbooks("C-CLIENT").Sheets(Nom).Activate
Range("A1").Select
ActiveSheet.Paste
'On copie colle uniquement le format des colonnes
Workbooks("C-CLIENT").Sheets(1).Activate
Columns("A:Q").Select
Selection.Copy
Workbooks("C-CLIENT").Sheets(Nom).Activate
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.ScreenUpdating = True
Unload Me
UserForm1.Show
End Sub |
Partager