Using an attendance sheet and where ColumA is "Date" ColumnB is "In" and ColumnC is "Out" and ColumnD is "Comments"
If i mention "A", "L", "any number like 5.0 in ColumnB" it will give result.
Wed 01-Jan-2020 | Absent | Personal |
in below code Column"C" is not mentioned where if i mention any number it means that the person is going "Early" it will
All i want is its result should be as like below image
Can anyone help me with this
Code
Sub Do_It()
With Sheets("data")
f = .Cells(.Rows.Count, "F").End(xlUp).Row
If f > 3 Then .Range("F4:H" & f).ClearContents
.Range("F3") = .Range("B1")
f = 3
For y = 3 To 33
a = .Cells(y, "A")
b = .Cells(y, "B")
c = .Cells(y, "C")
d = .Cells(y, "D")
If b <> Empty And b <> Empty Then
Select Case b
Case "a", "A"
txt = "Absent "
Case "l", "L"
txt = "Late "
Case Else
txt = "Leave "
End Select
f = f + 1
.Cells(f, "F") = Format(a, "ddd dd-mmm-yyyy")
.Cells(f, "G") = txt
.Cells(f, "H") = d
End If
Next y
End With
End Sub
Display More