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
| Option Explicit
Private Const PREMIERELIGNE As Integer = 5 ' A ADAPTER !!!
Private Const NOMFEUIL As String = "Par KDW" ' A ADAPTER !!!
Private Ligne As Long
Private Sub ComboBox1_Click()
Ligne = ComboBox1.ListIndex + PREMIERELIGNE
End Sub
Private Sub CommandButton1_Click()
If Ligne >= PREMIERELIGNE Then Sheets(NOMFEUIL).Range("B" & Ligne).Value = TextBox2.Value
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
ComboBox1.List = Sheets(NOMFEUIL).Range("A" & PREMIERELIGNE & ":A" & PremiereLigneVide(Sheets(NOMFEUIL).Cells)).Value
End Sub
Function PremiereLigneVide(Plage As Range) As Long
If WorksheetFunction.CountA(Plage) = 0 Then
PremiereLigneVide = Plage.Cells(1, 1).Row
Else
PremiereLigneVide = Plage.Find("*", , , , , xlPrevious).Row
End If
End Function |
Partager