Salut a tous, Forum salut,
Lorsque je me rends sur mon site bancaire, je recopie le montant de mon solde par un copier coller.
Puis je vais le coller dans ma comptabilité sous cette forme Ex: 568.24 € ca fonctionne très bien
Mais lorsque le chiffre est plus grand Ex: 1 472.35 € Là ça ne fonctionne plus
Alors j'ai essayer de faire un copier coller avec un chiffre comme 1472.35 € et là ca fonctionne bien.
J'en déduit que mon test ci dessous n'ai pas bon car dès qu'il voit un espace dans le chiffre , ca ne fonctionne plus
Merci de votre aide et bon W-end a tous.
Cdlt Ray
'*** TEXTBOX(1) ON ENTRE LE SOLDE BANQUAIRE COPIER-COLLER VERS FEUIL1(COMPTE) CELLULE (C20) SOLDE COPIER SUR SITE BANQUAIRE
'###
Private Sub TextBox1_Change()
Dim Couleur As Long: Dim Pos As Integer
If Len(TextBox1) = 0 Then Exit Sub
If Left(TextBox1, 1) = "-" Then
Pos = 1
End If
If Len(TextBox1) > Pos Then
If Not IsNumeric(Mid(TextBox1, Pos + 1)) Then
TextBox1 = ""
Exit Sub
End If
End If
Couleur = vbGreen
Ws.Range("C20") = Val(Replace(TextBox1.Value, ",", ".")) 'Copier vers la cellule C20 en décimal
If Ws.Range("C20") < 0 Then 'Si inférieur a zéro alors Rouge
Couleur = vbRed
End If
Label425.Caption = Format(Ws.Range("C20"), Euro) 'Affiche en euros dans Label425
Label425.ForeColor = Couleur
For i = 1 To 12
Controls("Label" & i + 216).Caption = Format(Ws.Cells(20, i + 4), Euro) 'Ligne 20 et Label 217:228
If Ws.Cells(20, i + 4) < 0 Then
Controls("Label" & i + 216).ForeColor = vbRed
Else
Controls("Label" & i + 216).ForeColor = vbGreen
End If
Next i
End Sub