• Initiateur de la discussion Initiateur de la discussion Antho35
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

Antho35

XLDnaute Occasionnel
Bonjour,

JK'ai créer un formulaire de saisie de donées via Userform, Une fois validé, les données vont dans un tableaux, cela marche parfétement.

Dans mon formulaire de saisie, Je veux voir pour les listes de choix le "Séléctionez...." (qui est présent dans le code si dessous, mais qui se positionnent uniquement lorsqu'on valide le formulaire), je pense qu'il est mal placé, mais ou le mettre ???)

Code:
Private Sub CheckBox1_Click()
Range("SYNTHESE_AUTRES!O65536").End(xlUp)(2).Value = IIf(CheckBox1, "X", "")
End Sub

Code:
Private Sub CheckBox2_Click()
Range("SYNTHESE_AUTRES!P65536").End(xlUp)(2).Value = IIf(CheckBox1, "X", "")
End Sub
Code:
Private Sub CommandButton1_Click()
Dim ligne As Integer
ligne = ActiveCell.Row
Range("B2").Select
'If Len(Sheets("SYNTHESE_AUTRES").Cells(ligne, 2))= Then
If Range("B2").Value = "" Then
ligne = Range("SYNTHESE_AUTRES!B65500").End(xlUp).Row + 1
Else
ligne = Range("SYNTHESE_AUTRES!B65500").End(xlUp).Row + 1
End If
Sheets("SYNTHESE_AUTRES").Cells(ligne, 1) = ligne
'End If
Sheets("SYNTHESE_AUTRES").Cells(ligne, 2) = Format(TextBox1, "2_2010_0000")
Sheets("SYNTHESE_AUTRES").Cells(ligne, 3) = Format(TextBox2, "mm/dd/yyyy")
Sheets("SYNTHESE_AUTRES").Cells(ligne, 4) = ComboBox1.Value
Sheets("SYNTHESE_AUTRES").Cells(ligne, 5) = ComboBox2.Value
Sheets("SYNTHESE_AUTRES").Cells(ligne, 12) = Format(TextBox4, "dd/mm/yyyy")
Sheets("SYNTHESE_AUTRES").Cells(ligne, 13) = Format(TextBox5, "hh:mm")
Sheets("SYNTHESE_AUTRES").Cells(ligne, 11) = ComboBox3.Value
Sheets("SYNTHESE_AUTRES").Cells(ligne, 10) = ComboBox4.Value
Sheets("SYNTHESE_AUTRES").Cells(ligne, 14) = TextBox6.Value
ComboBox1 = "Sélectionnez votre service"
ComboBox2 = "Sélectionnez le type de transport"
ComboBox3 = "Sélectionnez le lieu de RDV"
ComboBox4 = "Sélectionnez le motif"
TextBox1 = Format(TextBox1, "2_2010_0000")
TextBox2 = ""
TextBox4 = ""
TextBox5 = ""
TextBox6 = ""
confirmation2.Show
End Sub
Code:
Private Sub UserForm_Initialize()
Dim Dline As Integer
Dline = Range("SYNTHESE_AUTRES!B20000").End(xlUp).Row
TextBox1.Value = Dline
TextBox2.Value = Date
ComboBox1.ColumnCount = 1
ComboBox2.ColumnCount = 1
ComboBox3.ColumnCount = 1
ComboBox4.ColumnCount = 1
With ThisWorkbook.Worksheets("UF (2)")
For I = 4 To .Range("D65536").End(xlUp).Row
autresdemandes.ComboBox1.AddItem .Range("D" & I).Value
Next I
End With
With ThisWorkbook.Worksheets("TYPE DU TRANSPORTS")
For I = 3 To .Range("C65536").End(xlUp).Row
autresdemandes.ComboBox2.AddItem .Range("C" & I).Value
Next I
End With
With ThisWorkbook.Worksheets("MOTIF")
For I = 3 To .Range("C65536").End(xlUp).Row
autresdemandes.ComboBox4.AddItem .Range("C" & I).Value
Next I
End With
With ThisWorkbook.Worksheets("LIEUX DE RDV")
For I = 3 To .Range("C65536").End(xlUp).Row
autresdemandes.ComboBox3.AddItem .Range("C" & I).Value
Next I
End With
End Sub
Code:
Private Sub CommandButton2_Click()

Merci
anuleoperation2.Show
End Sub
 
Re : Liste UserForm

Bonjour, re Pierrot
Avec ce que je comprends
Code:
Private Sub UserForm_Initialize()
'...
With ThisWorkbook.Worksheets("UF (2)")
[COLOR="Blue"]ComboBox1.AddItem "Sélectionnez votre service"[/COLOR]
For I = 4 To .Range("D65536").End(xlUp).Row
ComboBox1.AddItem .Range("D" & I).Value
Next I
End With
'...
Code:
Private Sub CommandButton1_Click()
'...[COLOR="Blue"]
ComboBox1.ListIndex = 0[/COLOR]
'...
End Sub
Faudra vérifier l'index des combos avant validation
A+
kjin
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Réponses
10
Affichages
282
Réponses
5
Affichages
245
Réponses
4
Affichages
180
  • Question Question
Microsoft 365 worksheet_change
Réponses
29
Affichages
484
Réponses
9
Affichages
202
Réponses
1
Affichages
180
Retour