DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Sub izin()
gün = [G2]
süre = [G4]
hafta = [G6]
eski = WorksheetFunction.Max(2, Cells(Rows.Count, "A").End(3).Row)
Range("A2:E" & eski).ClearContents
With Range("A2:E" & eski).Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Range("A2:E" & eski).Font.Bold = False
son = Cells(Rows.Count, "H").End(3).Row
10:
yeni = Cells(Rows.Count, "A").End(3).Row + 1
Cells(yeni, "A") = gün
Cells(yeni, "B") = WorksheetFunction.Weekday(Cells(yeni, "A"), 2)
If WorksheetFunction.CountIf(Range("G10:G" & son), gün) > 0 Then
Cells(yeni, "C") = WorksheetFunction.VLookup(Cells(yeni, "A"), Range("G10:H" & son), 2, 0)
If Cells(yeni, "B") = hafta Then Cells(yeni, "E") = Cells(yeni, "A") + 0
With Range(Cells(yeni, "A"), Cells(yeni, "E")).Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 5296274
.TintAndShade = 0
.PatternTintAndShade = 0
End With
gün = gün + 1
GoTo 10
ElseIf Cells(yeni, "B") = hafta Then
Cells(yeni, "E") = Cells(yeni, "A") + 0
With Range(Cells(yeni, "A"), Cells(yeni, "E")).Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 5296274
.TintAndShade = 0
.PatternTintAndShade = 0
End With
gün = gün + 1
GoTo 10
Else
Cells(yeni, "D") = süre
süre = süre - 1
gün = gün + 1
If süre > 0 Then GoTo 10
End If
20:
yeni = Cells(Rows.Count, "A").End(3).Row + 1
If WorksheetFunction.CountIf(Range("G10:G" & son), gün) > 0 Then
Cells(yeni, "A") = gün
Cells(yeni, "B") = WorksheetFunction.Weekday(Cells(yeni, "A"), 2)
If Cells(yeni, "B") = hafta Then Cells(yeni, "E") = Cells(yeni, "A")
gün = gün + 1
GoTo 20
ElseIf WorksheetFunction.Weekday(Cells(yeni - 1, "A") + 1, 2) = hafta Then
Cells(yeni, "E") = Cells(yeni - 1, "A") + 1
Cells(yeni, "A") = gün
Cells(yeni, "B") = WorksheetFunction.Weekday(Cells(yeni - 1, "A") + 1, 2)
gün = gün + 1
GoTo 20
Else
Cells(yeni, "A") = gün
Cells(yeni, "B") = "İŞBAŞI"
With Range(Cells(yeni, "A"), Cells(yeni, "E")).Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Range(Cells(yeni, "A"), Cells(yeni, "E")).Font.Bold = True
End If
[G8] = gün
Range("A2:A" & yeni).NumberFormat = "[$-x-sysdate]dddd, mmmm dd, yyyy"
Range("E2:E" & yeni).NumberFormat = "[$-x-sysdate]dddd, mmmm dd, yyyy"
[H6] = Cells(Cells(Rows.Count, "A").End(3).Row, "A") + 1 - 1
End Sub