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
| Private Sub Worksheet_Activate()
Dim i As Integer, Choix1 As Integer, Choix2 As String
Dim j As Integer
Dim k As Integer
Dim l As Integer
Dim m As Integer
Dim n As Integer
Choix1 = InputBox("Voulez-vous créer ou modifier une opération ? - tapez 1 pour 'créer' ou 2 pour 'modifier'")
If Choix1 = 1 Then
Choix2 = InputBox("Entrez le type de programme pour l'opération que vous voulez créer - tapez 'PRN' ou 'OA' ou 'ACPS' ou 'IC' ou 'E' ou 'ENV'")
i = Sheets("Investissement").Range("B" & Sheets("Protection contre les Risques Naturels").Rows.Count).End(xlUp).Row + 1
i = IIf(i >= 4, i, 4)
j = Sheets("Investissement").Range("B" & Sheets("Ouvrages d'art").Rows.Count).End(xlUp).Row + 1
j = IIf(j >= 14, j, 14)
k = Sheets("Investissement").Range("B" & Sheets("Aménagements de Carrefours et Points Singuliers").Rows.Count).End(xlUp).Row + 1
k = IIf(k >= 34, j, 34)
l = Sheets("Investissement").Range("B" & Sheets("Pistes cyclables").Rows.Count).End(xlUp).Row + 1
l = IIf(l >= 36, j, 36)
m = Sheets("Investissement").Range("B" & Sheets("Etudes").Rows.Count).End(xlUp).Row + 1
m = IIf(m >= 38, j, 38)
n = Sheets("Investissement").Range("B" & Sheets("Environnement").Rows.Count).End(xlUp).Row + 1
n = IIf(n >= 44, j, 44)
If Choix2 = "PRN" Then
Sheets("Investissement").Range("B" & i).Value = Choix2
End If
If Choix2 = "OA" Then
Sheets("Investissement").Range("B" & j).Value = Choix2
End If
If Choix2 = "ACPS" Then
Sheets("Investissement").Range("B" & k).Value = Choix2
End If
If Choix2 = "IC" Then
Sheets("Investissement").Range("B" & l).Value = Choix2
End If
If Choix2 = "E" Then
Sheets("Investissement").Range("B" & m).Value = Choix2
End If
If Choix2 = "ENV" Then
Sheets("Investissement").Range("B" & n).Value = Choix2
End If
Else
'.........
End If
i = i + 1
j = j + 1
k = k + 1
l = l + 1
m = m + 1
n = n + 1
End Sub |
Partager