Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub CalculateEarning()
- Dim i As Integer
- Dim j As Integer
- Dim totalHours As Double
- Dim hour As Variant
- Dim hotel As String
- Dim present As Integer
- Dim off As Integer
- Dim absent As Integer
- Dim sick As Integer
- For Row = 3 To 340 Step 2
- totalHours = 0
- off = 0
- sick = 0
- absent = 0
- present = 0
- For Col = 3 To 36
- hour = Cells(Row, Col).Value
- hotel = Cells(Row + 1, Col).Value
- If hotel = "ATLANTIS" Then
- If IsNumeric(hour) Then
- present = present + 1
- totalHours = totalHours + CDbl(hour) * 14
- End If
- ElseIf hotel = "JABEEL" Or hotel = "J. SARAY" Or hotel = "JUM. EMIRATE" Or hotel = "AG TOWER" Then
- If IsNumeric(hour) Then
- present = present + 1
- totalHours = totalHours + CDbl(hour) * 8.4
- End If
- ElseIf hotel = "B Hotel" Or hotel = "BANQUET" Or hotel = "81-RES" Or hotel = "Leisure" Then
- If IsNumeric(hour) Then
- present = present + 1
- totalHours = totalHours + CDbl(hour) * 14
- End If
- ElseIf hotel = "WYNNDHAN" Or hotel = "MLNAM" Then
- If IsNumeric(hour) Then
- present = present + 1
- totalHours = totalHours + CDbl(hour) * 8
- End If
- ElseIf hotel = "JVC" Or hotel = "FIVE LUXE" Or hotel = "FIVE PALM" Then
- If IsNumeric(hour) Then
- present = present + 1
- End If
- ElseIf hotel = "P.PLANT " Or hotel = "P.PLANT" Then
- If hour = "P" Then
- present = present + 1
- End If
- ElseIf hotel = "HOLIDAY INN" Then
- If IsNumeric(hour) Then
- present = present + 1
- totalHours = totalHours + CDbl(hour) * 11
- End If
- End If
- If hour = "OFF" Or hour = "off" Then
- off = off + 1
- ElseIf hour = "S" Or hour = "SL" Then:
- sick = sick + 1
- ElseIf hour = "ABSENT" Or hour = "N/P" Then
- absent = absent + 1
- End If
- Next Col
- Cells(Row, 37).Value = off
- Cells(Row, 36).Value = present
- Cells(Row, 39).Value = totalHours
- Cells(Row, 35).Value = sick
- Cells(Row, 38).Value = absent
- Next Row
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement