السلام عليكم
أرجو من الاخوة المساعدة في ايجاد الخطأ في الكود التالي:
Private Sub CommandButton12_Click()
If TextBox88.Value = 0 Then
Dim i As Integer
i = 9
While Feuil2.Cells(i, 3) <> TextBox88.Value
i = i + 1
Wend
If Feuil2.Cells(i, 3) = TextBox88.Value Then
Feuil2.Cells(i, 3) = TextBox88
Feuil2.Cells(i, 3).Offset(0, 8) = TextBox118
Feuil2.Cells(i, 3).Offset(0, 10) = TextBox95
Feuil2.Cells(i, 3).Offset(0, 11) = TextBox120
With Feuil1
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Vents")
TextBox120 = Format(Date, "dd/mm/yyyy")
iRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
ws.Cells(iRow, 1).Value = iRow - 9
ws.Cells(iRow, 2).Value = CDate(Me.TextBox120.Value)
ws.Cells(iRow, 3).Value = Me.TextBox89.Value
ws.Cells(iRow, 4).Value = Me.TextBox92.Value
ws.Cells(iRow, 5).Value = Me.TextBox96.Value
ws.Cells(iRow, 6).Value = Me.TextBox91.Value
ws.Cells(iRow, 7).Value = Me.TextBox97.Value
ws.Cells(iRow, 8).Value = Me.TextBox93.Value
ws.Cells(iRow, 10).Value = Me.TextBox98.Value
End With
Else
While Feuil2.Cells(i, 3) <> TextBox88.Value
i = i + 1
Wend
Cells(i + 1, 3).Select: Selection.EntireRow.Insert
Cells(i, 11) = CDbl(Me.TextBox94) + CDbl(Me.TextBox118)
Cells(i + 1, 14) = Me.TextBox120
Cells(i + 1, 11) = Me.TextBox118
Cells(i, 13) = CDbl(Me.TextBox95)
Me.TextBox88.Value = ""
Me.TextBox89.Value = ""
Me.TextBox90.Value = ""
Me.TextBox94.Value = ""
Me.TextBox95.Value = ""
Me.TextBox118.Value = ""
Me.TextBox120.Value = ""
Me.TextBox92.Value = ""
Me.TextBox136.Value = ""
Me.TextBox91.Value = ""
Me.TextBox137.Value = ""
Me.TextBox93.Value = ""
Me.TextBox138.Value = ""
End If
End If
End Sub