Hello,
I have a small problem when updating a cell on a sheet trough a list box, and the list box as similar items when doing modifying the list box automatically selects the first item and I don't know how to solve this.
does anyone as any idea?
Example on the image if I modify the item KS755001 after that the list box selects the item KS755012.
here's the code:
If Me.Listboxcasouverts.ListIndex = -1 Then
' do something
MsgBox "Veuillez selectioner un cas dans la liste ci-dessous!"
Else
If newentry.Value = "" Then
MsgBox "Veuillez remplir la case!"
newentry.SetFocus
Else
If MsgBox("Voulez vous valider le protocole utilisé pour " & Me.infotypecas & " " & infonappareilcas & " ?", vbQuestion + vbYesNo, "") = vbNo Then
Cancel = True
Else
If Listecasouverts.protocoletextbox.Value = "" Then
Dim Rcell As Range
With Listecasouverts.Listboxcasouverts
Set Rcell = Range(.RowSource)(, 1).Resize(1).Offset(Listecasouverts.Listboxcasouverts.ListIndex, 9)
Rcell.Value = newentry.Value & " " & Format(Now, "dd.mm.yyyy, hh:MM")
newentry.Value = ""
End With
Else
Dim rcell2 As Range
With Listecasouverts.Listboxcasouverts
Set rcell2 = Range(.RowSource)(, 1).Resize(1).Offset(Listecasouverts.Listboxcasouverts.ListIndex, 9)
rcell2.Value = Listecasouverts.Listboxcasouverts.List(Listecasouverts.Listboxcasouverts.ListIndex, 9) & vbNewLine & vbNewLine & newentry.Value & " " & Format(Now, "dd.mm.yyyy, hh:MM")
newentry.Value = ""
End With
End If
End If
End If
End If
Bookmarks