Sub test()
Dim L As Long, C As Integer
Dim Valeur As Integer
Dim Cel
'Premiere recherche
Set Cel = Cells.Find("Total Nb paiements")
If Not Cel Is Nothing Then
L = Cel.Row
Set Cel = Cells.Find("Nombre de transactions")
If Not Cel Is Nothing Then
C = Cel.Column
Cells(1, 1) = Cells(L, C)
Valeur = Cells(1, 1).Value
Else 'Si on ne trouve pas la bonne colonne, alors on passe à la recherche suivante
GoTo Deuxieme_Recherche
End If
Else 'Si on ne trouve pas la bonne ligne, alors on passe à la recherche suivante
GoTo Deuxieme_Recherche
End If
'1) En déclarant la variable Valeur en integer, on s'assure du fait que ce soit un nombre
'2) Ensuite, avec le code ici, on enleve les caractères indésirables
Valeur = CDec(Replace(Replace(Valeur, " ", ""), "€", ""))
'2e recherche
Deuxieme_Recherche:
Set Cel = Cells.Find("Total TTC")
If Not Cel Is Nothing Then
L = Cel.Row
Set Cel = Cells.Find("Total")
If Not Cel Is Nothing Then
C = Cel.Column
Cells(5, 1) = Cells(L, C)
Valeur = Cells(5, 1).Value
Else 'Si on ne trouve pas la bonne colonne, alors on sort
Exit Sub
End If
Else 'Si on ne trouve pas la bonne ligne, alors on sort
Exit Sub
End If
Valeur = CDec(Replace(Replace(Valeur, " ", ""), "€", ""))
End Sub
Private Sub CommandButton1_Click()
test
End Sub