When there is an event on campus that students need to attend for course credit, there is a system we use to scan them in and register their attendance. The system is based on generating a CSV file with their ID number, date and time. We have created an Excel Spreadsheet that will accomplish this task.
Below you will find the Visual Basic code used to get the sheet functioning properly. If there ever needs to be a new sheet created for this purpose, use the code below to properly format the data in Excel. To show the visual basic editor, simply right click on the sheet name and then select "View Code." This will open up the editor where you can paste the code.
Simply copy and paste the following code into the VBA editor in Excel:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("A1:A1000")) Is Nothing Then
With Target(1, 2)
.Value = Date & " " & Time
.NumberFormat = ("yyyy-mm-dd hh:mm:ss")