1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
Sub Public Aurore()
Dim Test As String
Dim J As Integer
Dim I As Integer
Dim Somme As Long
Dim NumColonne As Integer
Dim Numero_Du_Compte As String
Dim Nombre_De_Chiffre As Integer
Numero_Du_Compte = InputBox("Saisir N° Compte")
If Numero_Du_Compte <> "" Then
Nombre_De_Chiffre = Val(InputBox("Saisir Nbr Chiffres"))
If Nombre_De_Chiffre > 0 Then
Somme = 0
For J = 1 To 20
If Worksheets(2).Cells(1, J).Value = "SOLDE" Then
NumColonne = J
End If
Next J
For I = 1 To 200
Test = Mid(Worksheets(2).Cells(I, 1).Value, 1, Nombre_De_Chiffre)
If Test = Numero_Du_Compte Then
Somme = Somme + Worksheets(2).Cells(I, NumColonne).Value
Worksheets(2).Cells(I, NumColonne).Interior.Color = RGB(200, 200, 200)
End If
Next
ActiveCell.Value = Somme
End If
End If
End Sub |