Erreur d'exécution 13

Alors j'ai un classeur de calcul de stock ça passe nickel sauf que j'ai des quantités à sortir avec virgule

si je fait stock a sortir 2 çà passe alors que un chiffre avec virgule ne fonctionne pas

Private Sub CmbValiderSortie_Click()
    Dim Derligne As Integer
    ListBoxDésignation.BackColor = &H80000005
    TxtQuantitéASortir.BackColor = &H80000005
    ComboDestination.BackColor = &H80000005

    If Me.ListBoxDésignation.ListIndex = -1 Then
        MsgBox " pas de sélection dans la liste, sortie impossible"
        ListBoxDésignation.BackColor = &H80FFFF
        ListBoxDésignation.SetFocus
        Exit Sub
    End If
    If Me.TxtQuantitéASortir = "" Then
        MsgBox " Quantité à sortir non définie, sortie impossible"
        TxtQuantitéASortir.BackColor = &H80FFFF
        TxtQuantitéASortir.SetFocus
        Exit Sub
    End If
    If Me.ComboDestination.ListIndex = -1 Then
        MsgBox " destination non définie, sortie impossible"
        ComboDestination.BackColor = &H80FFFF
        ComboDestination.SetFocus
        Exit Sub
    End If
      LigneDansBase = Me.ListBoxDésignation.List(ListBoxDésignation.ListIndex, 6)
      With Sheets("Infomed")
           If CLng(Me.TxtQuantitéASortir) > .Cells(LigneDansBase, 3) Then
               MsgBox "Le stock est insuffisant pour réaliser cette sortie"
               Exit Sub
           End If
     .Unprotect '"123"
     .Cells(LigneDansBase, 3) = .Cells(LigneDansBase, 3) - CLng(Me.TxtQuantitéASortir)
      Me.ListBoxDésignation.List(Compteur, 0) = .Cells(LigneDansBase, 3)
     .Protect '"123", True, True, , True
      End With
      With Sheets(ComboDestination.Value)
           .Unprotect '"123"
           Derligne = .Range("A1000").End(xlUp).Row + 1
           .Cells(Derligne, 1) = Me.ComboDésignation
           .Cells(Derligne, 2) = CLng(Me.TxtQuantitéASortir)
           .Cells(Derligne, 3) = Date
           .Protect ' "123", True, True, , True
      End With
      MsgBox "sortie effectuée"
      Unload Me

End Sub

Bonjour,

préciser la ligne en erreur permettrait de gagner du temps.

Dans une précédente discussion vous disiez avoir résolu votre problème de nombres décimaux par l'utilisation de la fonction de conversion CLng().

Or CLng convertit en entier, donc les décimaux seront tronqués.

a priori toutes les données issues de l'userform sont converties en Long, mais les données issues de la feuille ne seraient elles pas considérées comme string ?

Rechercher des sujets similaires à "erreur execution"