اخى الكريم
جرب المرفق
ان شاء الله هو المطلوب
تقبل تحياتى
هذا هو الكود اذا حابب تعرف ازاى اتعمل
Sub كشف_حساب()
If [e1] = "" Then MsgBox "الرجاء ادخال اسم الصنف اولاً": Exit Sub
If [e3] = "" Or [g3] = "" Then MsgBox "الرجاء اختيار الفترة المطلوبه": Exit Sub
Dim mo As String
Dim Lr As Long, i As Long
Dim r As Integer
Dim d1 As Double, d2 As Double
mo = Range("e1").Value
d1 = Range("e3").Value2
d2 = Range("g3").Value2
Range("c8:i100000").ClearContents
Application.ScreenUpdating = False
With Sheet27
Lr = .Cells(.Rows.Count, "d").End(xlUp).Row
For i = 4 To Lr
If mo = CStr(.Cells(i, "d")) Then
Select Case .Cells(i, "b").Value2
Case d1 To d2
r = r + 1
Cells(r + 7, "b").Value = r
Cells(r + 7, "c").Value = .Cells(i, "b")
Cells(r + 7, "d").Value = .Cells(i, "f")
Cells(r + 7, "e").Value = .Cells(i, "e")
Cells(r + 7, "f").Resize(1, 3).Value = .Cells(i, "g").Resize(1, 3).Value
Cells(r + 7, "i").Value = "=(R[-1]C+RC[-3])-(RC[-2]+RC[-1])"
End Select
End If
Next
End With
End Sub
mohammed acc15-12-2014.zip