Bonjour à tous,
Débutant dans la programmation d'un userform sur Excel, j'aimerais savoir comment et où intégrer des contrôles dans mon userform.
Mon objectif de ne rien valider si cela n'est pas totalement rempli. Mon userform comprends :
- Texbox
- Liste déroulante
- Option
Voici le code actuel :
'BOUTON ANNULER
Private Sub CBAnnuler_Click()
Unload Client
End Sub
'BOUTON VALIDER : à remplir avec instruction de saisie
Private Sub CBValider_Click()
With Sheets("Client").ListObjects("Tableau4")
If .ListRows.Count = 0 Then
Range("Tableau4[[#Headers],[Nom]]").Offset(1, 0) = 1
Range("Tableau4[[#Headers],[Nom]]").Offset(1, 0) = ""
End If
If .ListRows.Count = 1 And .ListRows(1).Range.Cells(1, 1) = "" Then
Set LignTablo = Sheets("Client").ListObjects("Tableau4").ListRows(1)
Else
Set LignTablo = Range("Tableau4").ListObject.ListRows.Add(AlwaysInsert:=True)
End If
End With
With LignTablo.Range
.Cells(1, 1) = TBD
.Cells(1, 2) = CBOF
.Cells(1, 4) = TBEntreprise
.Cells(1, 5) = TBNom
.Cells(1, 6) = Val(Replace(TBJours, ",", "."))
.Cells(1, 7) = Val(Replace(TBNote, ",", "."))
End With
If OBA = True Then .Cells(1, 3) = OBA.Caption
If OBS = True Then .Cells(1, 3) = OBS.Caption
Unload Client
End Sub
Private Sub UserForm_Initialize()
'Liste déroulante formation
CBOF.AddItem ("xxx")
CBOF.AddItem ("xxx")
CBOF.AddItem ("xxx")
CBOF.AddItem ("xxx")
CBOF.AddItem ("xxx")
CBOF.AddItem ("xxx")
'Code pour mettre la date en auto
Client.TBD = Format(Date, "dd-mmm.")
End Sub
Comment faire?