Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://excel-egy.com/forum/t4087
- ---------------------------------
- Sub Record_Absent_Students_To_Multiple_Sheets()
- Dim x, y, ws As Worksheet, sh As Worksheet, c As Range, s As String, cnt As Long
- Application.ScreenUpdating = False
- Set ws = ThisWorkbook.Worksheets(1)
- For Each c In ws.Range("A7:A" & ws.Cells(Rows.Count, 1).End(xlUp).Row)
- If InStr(c.Offset(, 2).Value, "أولى") Then
- Set sh = ThisWorkbook.Worksheets(3)
- ElseIf InStr(c.Offset(, 2).Value, "ثانيه") Then
- Set sh = ThisWorkbook.Worksheets(4)
- ElseIf InStr(c.Offset(, 2).Value, "ثالثه") Then
- Set sh = ThisWorkbook.Worksheets(5)
- Else
- MsgBox "Review The Student Grade At Row " & c.Row, vbExclamation: GoTo Skipper
- End If
- x = Application.Match(Val(c.Value), sh.Columns(1), 0)
- If Not IsError(x) Then
- y = Application.Match(CLng(Date), sh.Rows(7), 0)
- If Not IsError(y) Then
- sh.Cells(x, y).Value = "غ"
- cnt = cnt + 1
- End If
- Else
- s = s & IIf(s = "", "", " | ") & c.Value
- End If
- Skipper:
- Next c
- If cnt > 0 Then
- MsgBox "The Students That Have Been Recorded = " & cnt, vbInformation
- If s <> "" Then MsgBox "Students That Have Not Been Recorded " & vbNewLine & s, vbExclamation
- Else
- MsgBox "No Students Recorded At All", vbExclamation
- End If
- Application.ScreenUpdating = True
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement