Dim nomData As String
Option Explicit
Private Sub CommandButton1_Click()
If ListBox1.ListIndex = -1 Then Exit Sub
If ListBox2.ListIndex = -1 Then Exit Sub
Sheets(nomData).Range("D2") = ListBox2.List(ListBox2.ListIndex)
Sheets(nomData).Range("c2") = ListBox1.List(ListBox1.ListIndex)
CommandButton2_Click
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub ListBox2_Click()
End Sub
Private Sub UserForm_Initialize()
Dim trouve As Byte
Dim date1 As Date
Dim i As Integer
trouve = 0
nomData = "Feuil1"
'feuill1 en D2 et C2
If trouve = 0 Then
date1 = "1 / 1 / 2000"
With ListBox1 ' ComboBox1
.Clear
.ColumnCount = 1
For i = 0 To 11
.AddItem Format((DateAdd("m", i, date1)), "mmmm")
Next i
End With
date1 = Format(Now, "dd,mm,yyyy")
With ListBox2 ' ComboBox1
.Clear
.ColumnCount = 1
For i = 0 To 10
.AddItem Format((DateAdd("yyyy", i, date1)), "yyyy")
Next i
End With
End If
If trouve = 1 Then
ListBox1.Visible = False
ListBox2.Visible = False
Label1.Visible = False
Label2.Visible = False
CommandButton2.Visible = True
CommandButton1.Visible = False
Label3.Visible = True
End If
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then Cancel = True
End Sub