tallia64
XLDnaute Occasionnel
Bonjour je travaille sur un userform et notamment dans une combobox qui gère des badges. Les badges peuvent être utilisés par deux personnes donc sur mes lignes excel je les différencié par une couleur le problème est que quand j'active ma combobox elle m'affiche les deux chiffres des badges mais pas la couleur pour les différencier. Je vous transmets ci joint mes deux codes celui du userform et de la combobox. En espérant que vous puissiez m'aider. Je vous remercie d'avance.
Tallia64
Private Sub ComboBox1_Change()
Dim cpt As Integer
Dim temp As Integer
cpt = 3
temp = Val(ComboBox1.Text)
index = 0
While index = 0
If Range("E" & cpt) = temp And Range("I" & cpt) = "" Then
index = cpt
End If
cpt = cpt + 1
Wend
Frame1.Visible = True
On Error Resume Next
Box1 = Format(ActiveSheet.Cells(index, 1), ">")
Box2 = Format(ActiveSheet.Cells(index, 2), ">")
Box3 = Format(ActiveSheet.Cells(index, 3), ">")
box4 = Format(ActiveSheet.Cells(index, 4), ">")
box5 = Format(ActiveSheet.Cells(index, 5), ">")
Box6 = Format(ActiveSheet.Cells(index, 6), "hh:mm")
box7 = Format(ActiveSheet.Cells(index, 7), ">")
box8 = Format(ActiveSheet.Cells(index, 8), ">")
If ActiveSheet.Cells(index, 9) <> "" Then
box9 = Format(ActiveSheet.Cells(index, 9), "<")
Else
box9 = Date & " à " & time()
End If
'box9 = Format(ActiveSheet.Cells(index, 9), "hh:mm")
Box10 = Format(ActiveSheet.Cells(index, 10), ">")
box11 = Format(ActiveSheet.Cells(index, 11), ">")
box12 = Format(ActiveSheet.Cells(index, 12), ">")
Box13 = Format(ActiveSheet.Cells(index, 13), ">")
Box14 = Format(ActiveSheet.Cells(index, 14), ">")
End Sub
Private Sub UserForm_Initialize()
Dim cpt As Integer
Frame1.Visible = False
Range("F2").Select
Range("A2:N500").Sort Key1:=Range("E3"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
SortMethod:=xlSortTextAsNumbers
'La combo sélectionne un à un
For cpt = 3 To 500
If Range("I" & cpt) = "" And Range("A" & cpt) <> "" Then
ComboBox1.AddItem Range("E" & cpt)
End If
Next cpt
'ComboBox1.RowSource = "service_general!e3:e500"
ComboBox1.Value = ""
'index = Range("e65536").End(xlUp).Row - 1 '2
'index = ComboBox1.ListIndex + 3
End Sub
Tallia64
Private Sub ComboBox1_Change()
Dim cpt As Integer
Dim temp As Integer
cpt = 3
temp = Val(ComboBox1.Text)
index = 0
While index = 0
If Range("E" & cpt) = temp And Range("I" & cpt) = "" Then
index = cpt
End If
cpt = cpt + 1
Wend
Frame1.Visible = True
On Error Resume Next
Box1 = Format(ActiveSheet.Cells(index, 1), ">")
Box2 = Format(ActiveSheet.Cells(index, 2), ">")
Box3 = Format(ActiveSheet.Cells(index, 3), ">")
box4 = Format(ActiveSheet.Cells(index, 4), ">")
box5 = Format(ActiveSheet.Cells(index, 5), ">")
Box6 = Format(ActiveSheet.Cells(index, 6), "hh:mm")
box7 = Format(ActiveSheet.Cells(index, 7), ">")
box8 = Format(ActiveSheet.Cells(index, 8), ">")
If ActiveSheet.Cells(index, 9) <> "" Then
box9 = Format(ActiveSheet.Cells(index, 9), "<")
Else
box9 = Date & " à " & time()
End If
'box9 = Format(ActiveSheet.Cells(index, 9), "hh:mm")
Box10 = Format(ActiveSheet.Cells(index, 10), ">")
box11 = Format(ActiveSheet.Cells(index, 11), ">")
box12 = Format(ActiveSheet.Cells(index, 12), ">")
Box13 = Format(ActiveSheet.Cells(index, 13), ">")
Box14 = Format(ActiveSheet.Cells(index, 14), ">")
End Sub
Private Sub UserForm_Initialize()
Dim cpt As Integer
Frame1.Visible = False
Range("F2").Select
Range("A2:N500").Sort Key1:=Range("E3"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
SortMethod:=xlSortTextAsNumbers
'La combo sélectionne un à un
For cpt = 3 To 500
If Range("I" & cpt) = "" And Range("A" & cpt) <> "" Then
ComboBox1.AddItem Range("E" & cpt)
End If
Next cpt
'ComboBox1.RowSource = "service_general!e3:e500"
ComboBox1.Value = ""
'index = Range("e65536").End(xlUp).Row - 1 '2
'index = ComboBox1.ListIndex + 3
End Sub