الاخ حاتم عيسى
انت هنا تعرض كودد الملف
Omar_2.rar
مع ملف اوراقة المعنية محمية
كان من الواجب عرض كود الملف
Omar_3.rar
لا يجوز هذا الخلط
وها هو كود الملف
Omar_3.rar
Option Base 1
Sub Transfer_Data()
'
Dim Sh_Master As Worksheet
Dim Rng As Range
Dim Arr()
Application.ScreenUpdating = False
'======================================================================================
UnProtect_Me
Set Sh_Master = Sheets("الرئيسية")
For Each Sh In Sheets
If Sh.Name <> Sh_Master.Name Then
Sh.Range("A7:H" & Rows.Count).ClearContents
End If
Next
End_Row = Sh_Master.Cells(Rows.Count, "C").End(xlUp).Row
Set Rng = Sh_Master.Range("A6:N" & End_Row)
Arr = Rng
'======================================================================================
For Row = 2 To UBound(Arr)
For Col = 7 To 12
If Arr(Row, Col) = 1 Then
ShName = Arr(1, Col)
End_Row = Sheets(ShName).Cells(Rows.Count, "C").End(xlUp).Row + 1
Set Rng = Range(Sh_Master.Cells(Row + 5, "A"), Sh_Master.Cells(Row + 5, "F"))
Rng.Copy Sheets(ShName).Range("A" & End_Row)
Sheets(ShName).Range("G" & End_Row) = Arr(1, Col)
'==============================
Sheets(ShName).Range("H" & End_Row) = Sh_Master.Cells(Row + 5, "N") - 1
' OR
' Sheets(ShName).Range("H" & End_Row) = "عنده مواد ثانية"
'==============================
End If
Next
Next
'======================================================================================
Protect_Me
Application.ScreenUpdating = True
'
End Sub
Sub Protect_Me()
'
Dim Sh As Worksheet
'
Pass = "123"
For Each Sh In Sheets
If Sh.Name <> ActiveSheet.Name Then
Sh.Protect Password:=Pass
End If
Next
'
End Sub
Sub UnProtect_Me()
'
Dim Sh As Worksheet
'
Pass = "123"
For Each Sh In Sheets
Sh.Unprotect Password:=Pass
Next
'
End Sub