XL 2013 Nombre stocké Sous forme de texte

Appo1985

XLDnaute Occasionnel
Bonjour à tous
Je remplis mes données à l'aide d'un userform mais il ya une erreur qui s'affiche. Ce qui fait que lorsque que je veux appliquer une formule ça ne donne pas. L'erreur me dit que "nombre stocké sous forme de texte."
Je voudrais de l'aide pour la solution.
Ci-joint le fichier
Merci par avance
 

Pièces jointes

  • ERREUR NOMBRE.xlsm
    39.4 KB · Affichages: 2
Solution
Bonjour,

VB:
Private Sub CommandButton1_Click()

Dim DerniereLigne As Long

   With Sheets("5C")
        .Activate
        DerniereLigne = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
        .Cells(DerniereLigne, 1) = Val(TextBox1)
        .Cells(DerniereLigne, 2) = Val(TextBox2)
        .Cells(DerniereLigne, 3) = Val(TextBox3)
        .Cells(DerniereLigne, 4) = Val(TextBox4)
        .Cells(DerniereLigne, 5) = Val(TextBox5)
        With .Range(.Cells(DerniereLigne, 1), .Cells(DerniereLigne, 5))
             .NumberFormat = "#,##0"
             .HorizontalAlignment = xlCenter
        End With
   End With
  
   TextBox1 = "": TextBox2 = "": TextBox3 = "": TextBox4 = "": TextBox5 = ""
   TextBox1.SetFocus
        

End Sub

Eric KERGRESSE

XLDnaute Occasionnel
Bonjour,

VB:
Private Sub CommandButton1_Click()

Dim DerniereLigne As Long

   With Sheets("5C")
        .Activate
        DerniereLigne = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
        .Cells(DerniereLigne, 1) = Val(TextBox1)
        .Cells(DerniereLigne, 2) = Val(TextBox2)
        .Cells(DerniereLigne, 3) = Val(TextBox3)
        .Cells(DerniereLigne, 4) = Val(TextBox4)
        .Cells(DerniereLigne, 5) = Val(TextBox5)
        With .Range(.Cells(DerniereLigne, 1), .Cells(DerniereLigne, 5))
             .NumberFormat = "#,##0"
             .HorizontalAlignment = xlCenter
        End With
   End With
  
   TextBox1 = "": TextBox2 = "": TextBox3 = "": TextBox4 = "": TextBox5 = ""
   TextBox1.SetFocus
        

End Sub
 

Appo1985

XLDnaute Occasionnel
Bonjour,

VB:
Private Sub CommandButton1_Click()

Dim DerniereLigne As Long

   With Sheets("5C")
        .Activate
        DerniereLigne = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
        .Cells(DerniereLigne, 1) = Val(TextBox1)
        .Cells(DerniereLigne, 2) = Val(TextBox2)
        .Cells(DerniereLigne, 3) = Val(TextBox3)
        .Cells(DerniereLigne, 4) = Val(TextBox4)
        .Cells(DerniereLigne, 5) = Val(TextBox5)
        With .Range(.Cells(DerniereLigne, 1), .Cells(DerniereLigne, 5))
             .NumberFormat = "#,##0"
             .HorizontalAlignment = xlCenter
        End With
   End With
  
   TextBox1 = "": TextBox2 = "": TextBox3 = "": TextBox4 = "": TextBox5 = ""
   TextBox1.SetFocus
        

End Sub
Bonjour. J'ai testé et ça marche bien. Grandement merci
 

Discussions similaires

Statistiques des forums

Discussions
312 215
Messages
2 086 319
Membres
103 177
dernier inscrit
grizly