ssassam
XLDnaute Occasionnel
Bonjour les amis,
Svp j'ai un bon code sauf qu'il beug par fois et me sort la fameuse Erreur 1004
Ci-aprés mon code , svp me corriger la ligne d'errer .
Cordialement.
Svp j'ai un bon code sauf qu'il beug par fois et me sort la fameuse Erreur 1004
Ci-aprés mon code , svp me corriger la ligne d'errer .
Code:
Option Explicit
Dim mot1 As String, mot2 As String, mot3 As String
Dim c As Integer, d As Integer
Dim e As Double
Dim cell As Range, cel As Range, Rg1 As Range, Rg2 As Range
Sub calculer()
e = Range("B23")
mot1 = Range("B16").Text
Set Rg1 = Sheets("BUDGET_BC").Range("c1:" & Range("C1").End(xlToRight).Address)
For Each cell In Rg1
If cell.Value = mot1 Then
c = cell.Column
GoTo suite
End If
Next cell
suite:
mot2 = Range("B17").Text
mot3 = Range("B18").Text
Set Rg2 = Sheets("BUDGET_BC").Range("A2:" & Range("A2").End(xlDown).Address)
For Each cel In Rg2
If cel.Value = mot2 And cel.Offset(0, 1).Value = mot3 Then
d = cel.Row
GoTo suite2
End If
Next cel
suite2:
Sheets("BUDGET_BC").Cells(d, c) = Sheets("BUDGET_BC").Cells(d, c) - e
Call hist
Sheets("BC").Range("B23").ClearContents
End Sub
Cordialement.