عليكم السلام انا هحاول اساعد
هذا الكود اهدانى اياه استاذى العزيز استاذ سليم ربنا يحفظه
فيه الى حضرتك عايزاه بس يحتاج تعديل طبعا
لعله يفيدك
CODE
Option Explicit
Sub Trasfer_data_Special()
Dim R As Worksheet, Act_sh As Worksheet
Dim k%, col%, Ro%
Dim Max_ro%, x%, y%
Dim Bol As Boolean
Dim ST_Dat As Date
Dim End_Dat As Date
Dim My_sum#
Dim Mot$
Mot = "ÇáÇÌãÇáì"
Set R = Sheets("Report_Youmi")
Ro = R.Cells(Rows.Count, 1).End(3).Row
R.Range("C3").CurrentRegion.Resize(Ro - 1).ClearContents
R.Cells(3, 9).Resize(Ro - 2).ClearContents
ST_Dat = Application.Min(R.Range("I2:J2"))
End_Dat = Application.Max(R.Range("I2:J2"))
For k = 3 To Ro - 2
Bol = Application.Evaluate _
("ISREF('" & R.Range("A" & k) & "'!A1)")
If Bol Then
Set Act_sh = Sheets(R.Range("A" & k) & "")
Max_ro = Act_sh.Cells(Rows.Count, 1).End(3).Row
For y = 3 To 7
For x = 5 To Max_ro
If CDate(Act_sh.Cells(x, 1)) >= ST_Dat And _
CDate(Act_sh.Cells(x, 1)) <= End_Dat And _
Act_sh.Cells(x, 2) <> Mot Then
My_sum = My_sum + IIf(IsNumeric(Act_sh.Cells(x, y + 2)), _
Act_sh.Cells(x, y + 2), 0)
End If
Next x
R.Cells(k, y).Value = IIf(My_sum = 0, "", My_sum): My_sum = 0
Next y
End If
Next k
'+++++++++++++++++++++++++++++++++
R.Cells(Ro - 1, 3).Resize(, 5).Formula = _
"=Sum(C$4:C$" & Ro - 2 & ")"
R.Cells(Ro, 3).Resize(, 5).Formula = _
"=Sum(C$7:C$18)"
R.Cells(3, 9).Resize(Ro - 3).Formula = _
"=IF(COUNTA($C3:$G3)>0,SUM($C3:$G3),"""")"
R.Cells(Ro, 9).Formula = _
"=SUM(C" & Ro & ":G" & Ro & ")"
R.Range("A3:I" & Ro).Value = _
R.Range("A3:I" & Ro).Value
'ÑÓÇáÉ ÈÇáÈíÇäÇÊ ÇáãÑÍáÉ
MsgBox ("Êã ÇÓÊÏÚÇÁÇáÈíÇäÇÊ")
End Sub