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 86 87 88 89 90 91 92 93 94 95 96
| Private Sub CommandButton1_Click()
Dim i As Integer
ville1 = ville.Value
Unload UserForm1
End Sub
Private Sub CommandButton2_Click()
Unload UserForm1
Exit Sub
End Sub
Private Sub departement_Change()
Dim i As Integer, n As Integer
Sheets("humidité").Select
n = 0
While Cells(3 + n, 2) <> ""
n = n + 1
Wend
ville.Clear
For i = 1 To n
If departement.Value = Cells(2 + i, 2) Then
ville.AddItem Range("C" & i + 2)
End If
Next
End Sub
Private Sub Label2_Click()
End Sub
Private Sub ListBox1_Click()
If ville.Value <> 0 Then
CommandButton1.Enabled = True
End If
End Sub
Private Sub UserForm_initialize()
Dim i As Integer
Dim n As Integer
Sheets("humidité").Select
ville.Clear
CommandButton1.Enabled = False
n = 0
While Cells(3 + n, 2) <> ""
n = n + 1
Wend
For i = 1 To n
If i = 1 Then
departement.AddItem Range("B" & i + 2)
Else
If Cells(i + 2, 2) <> Cells(i + 1, 2) Then
departement.AddItem Range("B" & i + 2)
End If
End If
Next
ListBox1.ListIndex = -1
For i = 1 To 12
ListBox1.AddItem Cells(1, i + 4)
Next
End Sub
Private Sub ville_Change()
Dim i As Integer
For i = 0 To 11
If ListBox1.Selected(i) = True Then
CommandButton1.Enabled = True
Exit For
End If
Next
End Sub |
Partager