[excel] row selection in listbox

Solved
ced3c Posted messages 240 Status Member -  
ced3c Posted messages 240 Status Member -
Hello,
I don't know how to indicate that no line is selected.

Private Sub CommandButton4_Click() If ExtraitVente.ListCount = 1 And ExtraitVente.Row.Select = 0 Then MsgBox ("Select a line to delete") ElseIf ExtraitVente.ListCount = 0 Then MsgBox ("No products in the table") Else Me.TextBox4 = Me.TextBox4 - (ExtraitVente.List(ExtraitVente.ListIndex, 5)) Me.TextBox5 = Me.TextBox5 - (ExtraitVente.List(ExtraitVente.ListIndex, 6)) Me.TextBox6 = Me.TextBox6 - (ExtraitVente.List(ExtraitVente.ListIndex, 7)) Me.ExtraitVente.RemoveItem (Me.ExtraitVente.ListIndex) End If End Sub


ExtraitVente.Row.Select = 0
is indeed false, but I don't know how to express that.

Thank you :)

Configuration: Windows 7 / Safari 535.2

4 answers

  1. ced3c Posted messages 240 Status Member 5
     
    little bump for help please
    0
  2. ced3c Posted messages 240 Status Member 5
     
    Re up, sorry to "re up" but I'm a bit stuck on this code and I don't know how to proceed at all.
    0
  3. gbinforme Posted messages 14930 Registration date   Status Contributor Last intervention   4 744
     
    Hello

    Probably like this:

    Private Sub CommandButton4_Click() If ExtraitVente.ListIndex < 0 Then MsgBox ("Select a line to delete") Else Me.TextBox4 = Me.TextBox4 - (ExtraitVente.List(ExtraitVente.ListIndex, 5)) Me.TextBox5 = Me.TextBox5 - (ExtraitVente.List(ExtraitVente.ListIndex, 6)) Me.TextBox6 = Me.TextBox6 - (ExtraitVente.List(ExtraitVente.ListIndex, 7)) Me.ExtraitVente.RemoveItem (Me.ExtraitVente.ListIndex) End If End Sub 

    --

    Always calm
    0
  4. ced3c Posted messages 240 Status Member 5
     
    Thank you very much once again, it works perfectly.
    0