أخى فضل
السلام عليكم ورحمة الله وبركاته
كل عام وأنتم بحير
تفضل أخى ما تريد
Sub ragab()
Application.ScreenUpdating = False
[H3:K100].ClearContents
For i = 2 To Range("A" & Rows.Count).End(xlUp).Row
cl = Trim(Cells(i, 1))
If cl = [H2] Then
cll = Trim(Cells(i, 2))
x = UBound(Filter(Split(MyArr, ","), cll)) + 1
If x = 0 Then MyArr = MyArr & Trim(cll) & ","
End If
Next
MyArr = Left(MyArr, Len(MyArr) - 1)
ii = 3
For Each c In Split(MyArr, ",")
Cells(ii, 8) = c
ii = ii + 1
Next
For y = 3 To 15
For t = 2 To 37
If Cells(t, 1) = [H2] And Cells(t, 2) = Cells(y, "H") Then
Cells(y, "H").Offset(0, 1) = Cells(t, 3): Exit For
End If
Next
Next
For y = 3 To 15
For t = 2 To 37
If Cells(t, 1) = [H2] And Cells(t, 2) = Cells(y, "H") Then
Cells(y, "H").Offset(0, 2) = Cells(t, 3)
Cells(y, "H").Offset(0, 3) = (Cells(y, "H").Offset(0, 2).Value - Cells(y, "H").Offset(0, 1).Value) + 1
End If
Next
Next
Application.ScreenUpdating = True
End Sub
استخراج اقسام المدرسة وارقام الجلوس لكل قسم .rar