How to create an attendance registration system via Excel Workbook
Автор: KHAIRI MUHAMMAD HAIKAL OMAR
Загружено: 2025-10-31
Просмотров: 17
Описание:
COPY THIS
Private Sub Worksheet_Change(ByVal Target As Range)
' This code runs when any cell on the sheet is changed
' Check if the changed cell is in the "Status" column (Column 3)
' and if only one cell was changed
If Target.Column = 3 And Target.Cells.Count = 1 Then
' Disable events to prevent the code from running in a loop
Application.EnableEvents = False
' Check if the new value is "Present"
If Target.Value = "Present" Then
' Put the current date and time in the "Timestamp" column (Column 4)
' Target.Offset(0, 1) means "the cell 0 rows down, 1 column over"
Target.Offset(0, 1).Value = Now()
' Optional: Format the cell to show date and time clearly
Target.Offset(0, 1).NumberFormat = "m/d/yyyy h:mm AM/PM"
' If the status is cleared or changed to "Absent"
ElseIf Target.Value = "Absent" Or Target.Value = "" Then
' Clear the timestamp
Target.Offset(0, 1).Value = ""
End If
' Re-enable events
Application.EnableEvents = True
End If
End Sub
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: