Bonsoir jean marie,Bonsoir JBARBE
je ne pense pas mais je peux me tromper lol
que l'on puisse faire ce que tu veux a partir d'un InputBox (je ne connais pas d'événement que l'on puisse exploiter) ????mais tu pourrais cerer un Userform qui ressemblerait a un InputBox qui ferait ce que fait un InputBox mais qui ne serait pas un InputBox !
Amicalement
jean marie
Option Explicit
Dim DerLgn As Integer
Dim DerCol As Byte
Dim TabGeneral
Private Sub UserForm_Initialize()
With Worksheets("Feuil1") 'Avec la feuille
DerLgn = .Cells(.Rows.Count, 1).End(xlUp).Row 'On définit la dernière ligne non vide de la Colonne "A"
DerCol = .Cells(2, .Columns.Count).End(xlToLeft).Column 'On définit la dernièrColonne non vide de la Ligne 2
With .Range(.Cells(3, 1), Cells(DerLgn, DerCol)) 'Avec la Plage ainsi définie
.Sort .Cells(1, 1), , , , xlYes 'o trie la Plage en fonction de la Colonne "A"
TabGeneral = .Value 'On récupére les données de la Plage dans un tableau temporaire
End With
End With
With Me 'avec le Userform
With .ComboBox1 'Avec le ComboBox
.List = Application.Index(TabGeneral, , 1)'On récupére la première colonne dans le ComboBox
End With
End With
End Sub
Private Sub ComboBox1_Change()
Dim lig As Variant
Dim Sht As Worksheet
Set Sht = Worksheets("Feuil1")
Application.ScreenUpdating = False
'------------
With UserForm1
lig = Application.Match(.ComboBox1, Sht.Columns("A"), 0)'On détermine la ligne ou se trouvent les données
.TextBox1 = Sht.Cells(lig, 2)
.TextBox2 = Sht.Cells(lig, 3)
.TextBox3 = Sht.Cells(lig, 4)
.TextBox4 = Sht.Cells(lig, 5)
.TextBox5 = Sht.Cells(lig, 6)
.TextBox6 = Sht.Cells(lig, 7)
.TextBox7 = Sht.Cells(lig, 8)
.TextBox8 = Sht.Cells(lig, 9)
.TextBox9 = Sht.Cells(lig, 10)
.TextBox10 = Sht.Cells(lig, 11)
End With
Application.ScreenUpdating = True
End Sub
On ne peut pas sous cette configuration afficher plusieurs Lignes(TextBox)A noter qu'il peut avoir plusieurs lignes saisies pour ce cheval !
Sht.TextBox1 = Cells(lig, 2)
.TextBox1 = Sht.Cells(lig, 2)
.TextBox1.Value = Format(TextBox1.Value, "hh:mm:ss.00")
Private Sub ComboBox1_Change()
Dim lig As Variant
Dim Sht As Worksheet
Set Sht = Worksheets("Feuil1")
Application.ScreenUpdating = False
With UserForm1
lig = Application.Match(ComboBox1, Sht.Columns("A"), 0)
On Error GoTo fin
.TextBox1 = Sht.Cells(lig, 2)
.TextBox1.Value = Format(TextBox1.Value, "hh:mm:ss.00")
.TextBox2 = Sht.Cells(lig, 3)
.TextBox3 = Sht.Cells(lig, 4)
.TextBox4 = Sht.Cells(lig, 5)
.TextBox5 = Sht.Cells(lig, 6)
.TextBox6 = Sht.Cells(lig, 7)
.TextBox7 = Sht.Cells(lig, 8)
.TextBox8 = Sht.Cells(lig, 9)
.TextBox9 = Sht.Cells(lig, 10)
.TextBox10 = Sht.Cells(lig, 11)
Exit Sub
End With
fin:
Range("A3").End(xlDown).Offset(1, 0).Select
Application.ScreenUpdating = True
End Sub
.TextBox1.Value = Format(TextBox1.Value, "hh:mm:ss.00")
.TextBox1.Value = Format( Sht.Cells(lig, 2), "hh:mm:ss,000")