DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Sub puantaj_aspava()
Dim Si As Worksheet, Sp As Worksheet, trh As Date, gun As Byte, deg As String, j As Byte, Adr1 As String
Dim i As Long, c As Range, Adr As String, bsl As Date, bts As Double, d As Range, k As Byte, ay As String
Set Si = Sheets("İzin İcmal")
Set Sp = Sheets("Pazar icmal")
With Application
.ScreenUpdating = False
.Calculation = xlManual
.EnableEvents = False
End With
Sheets("puantaj").Select
Range("G5:AK104").ClearContents
ay = WorksheetFunction.Proper(UCase(Replace(Replace([AD2], "ı", "I"), "i", "İ")))
trh = DateSerial([AI2], Month("1." & [AD2] & "." & [AI2]) + 1, 0)
gun = Day(trh)
For i = 5 To 104
Cells(i, "G").Resize(1, gun) = "X"
For j = 7 To 37
If Cells(3, j) = "Pazar" Then
Cells(i, j) = "HT"
End If
Next j
Set d = Sp.[A:A].Find(Cells(i, "B"), , xlFormulas, xlWhole)
If Not d Is Nothing Then
Adr1 = d.Address
Do
If Format(Sp.Cells(d.Row, "C"), "MMMM") = ay Then
Cells(i, Day(Sp.Cells(d.Row, "C")) + 6) = "X"
End If
Set d = Sp.[A:A].FindNext(d)
Loop While Not d Is Nothing And d.Address <> Adr1
End If
If Format(Cells(i, "F"), "MMMM") = ay And Cells(i, "F") <> "" Then
Cells(i, "G").Resize(1, Day(Cells(i, "F"))) = ""
End If
If Format(Cells(i, "AL"), "MMMM") = ay And Cells(i, "AL") <> "" Then
Cells(i, 7 + Day(Cells(i, "AL"))).Resize(1, trh - Cells(i, "AL")) = ""
End If
Set c = Si.[A:A].Find(Cells(i, "B"), , xlFormulas, xlWhole)
If Not c Is Nothing Then
Adr = c.Address
Do
bsl = Si.Cells(c.Row, "C")
bts = Si.Cells(c.Row, "D")
If Format(bsl, "MMMM") <> ay And Format(bts, "MMMM") <> ay Then Exit Do
If Si.Cells(c.Row, "E") > 0 Then
If Format(bsl, "MMMM") = ay And Format(bts, "MMMM") = ay Then
bsl = Day(bsl)
bts = Si.Cells(c.Row, "E")
ElseIf Format(bsl, "MMMM") <> ay And Format(bts, "MMMM") = ay Then
bsl = 1
bts = Day(bts)
Else
bts = trh - bsl + 1
bsl = Day(bsl)
End If
If WorksheetFunction.CountIf(Si.[K:K], Si.Cells(c.Row, "F")) > 0 Then
k = WorksheetFunction.Match(Si.Cells(c.Row, "F"), Si.[K:K], 0)
Cells(i, bsl + 6).Resize(1, bts) = Si.Cells(k, "L")
Else
Cells(i, bsl + 6).Resize(1, bts) = ""
End If
End If
Set c = Si.[A:A].FindNext(c)
Loop While Not c Is Nothing And c.Address <> Adr
End If
Next i
With Application
.Calculation = xlAutomatic
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
@Ömer hocam şablonda yaptığım düzenleme ve AÇIKLAMA sekmesinde gerekli açıklamaları yazdım. bu tablo ve şablon ile açıklamalar ışığında yapabilir miyiz kusura bakmayın sizi de yordum hakkınızı helal edinSayın @aligunes
Son 2 yazdığınızdan başlayayım. Diğer yazdıklarınızı anlamadım.
1) Eğer eski sütunların yeri değişirse evet bozulur.,
2) Yapılabilir, yalnız diğer konular netleşince ilavesini yaparız.
Ömer Hocam , Bir şey fark ettim işe girişleri 1 gün sonrasında puantajda gösteriyor. Çıkışlarda sorun gözükmüyor.Blokların sırası hatalı olmuş.
Deneyiniz.
Kod:Sub puantaj_aspava() Dim Si As Worksheet, Sp As Worksheet, trh As Date, gun As Byte, deg As String, j As Byte, Adr1 As String Dim i As Long, c As Range, Adr As String, bsl As Date, bts As Double, d As Range, k As Byte, ay As String Set Si = Sheets("İzin İcmal") Set Sp = Sheets("Pazar icmal") With Application .ScreenUpdating = False .Calculation = xlManual .EnableEvents = False End With Sheets("puantaj").Select Range("G5:AK104").ClearContents ay = WorksheetFunction.Proper(UCase(Replace(Replace([AD2], "ı", "I"), "i", "İ"))) trh = DateSerial([AI2], Month("1." & [AD2] & "." & [AI2]) + 1, 0) gun = Day(trh) For i = 5 To 104 Cells(i, "G").Resize(1, gun) = "X" For j = 7 To 37 If Cells(3, j) = "Pazar" Then Cells(i, j) = "HT" End If Next j Set d = Sp.[A:A].Find(Cells(i, "B"), , xlFormulas, xlWhole) If Not d Is Nothing Then Adr1 = d.Address Do If Format(Sp.Cells(d.Row, "C"), "MMMM") = ay Then Cells(i, Day(Sp.Cells(d.Row, "C")) + 6) = "X" End If Set d = Sp.[A:A].FindNext(d) Loop While Not d Is Nothing And d.Address <> Adr1 End If If Format(Cells(i, "F"), "MMMM") = ay And Cells(i, "F") <> "" Then Cells(i, "G").Resize(1, Day(Cells(i, "F"))) = "" End If If Format(Cells(i, "AL"), "MMMM") = ay And Cells(i, "AL") <> "" Then Cells(i, 7 + Day(Cells(i, "AL"))).Resize(1, trh - Cells(i, "AL")) = "" End If Set c = Si.[A:A].Find(Cells(i, "B"), , xlFormulas, xlWhole) If Not c Is Nothing Then Adr = c.Address Do bsl = Si.Cells(c.Row, "C") bts = Si.Cells(c.Row, "D") If Format(bsl, "MMMM") <> ay And Format(bts, "MMMM") <> ay Then Exit Do If Si.Cells(c.Row, "E") > 0 Then If Format(bsl, "MMMM") = ay And Format(bts, "MMMM") = ay Then bsl = Day(bsl) bts = Si.Cells(c.Row, "E") ElseIf Format(bsl, "MMMM") <> ay And Format(bts, "MMMM") = ay Then bsl = 1 bts = Day(bts) Else bts = trh - bsl + 1 bsl = Day(bsl) End If If WorksheetFunction.CountIf(Si.[K:K], Si.Cells(c.Row, "F")) > 0 Then k = WorksheetFunction.Match(Si.Cells(c.Row, "F"), Si.[K:K], 0) Cells(i, bsl + 6).Resize(1, bts) = Si.Cells(k, "L") Else Cells(i, bsl + 6).Resize(1, bts) = "" End If End If Set c = Si.[A:A].FindNext(c) Loop While Not c Is Nothing And c.Address <> Adr End If Next i With Application .Calculation = xlAutomatic .ScreenUpdating = True .EnableEvents = True End With End Sub
Sayın @aligunes@Ömer hocam şablonda yaptığım düzenleme ve AÇIKLAMA sekmesinde gerekli açıklamaları yazdım. bu tablo ve şablon ile açıklamalar ışığında yapabilir miyiz kusura bakmayın sizi de yordum hakkınızı helal edin
Sub puantaj()
Dim Si As Worksheet, St As Worksheet, son As Long, trh As Date, gun As Byte, deg As String, j As Integer, k As Byte
Dim i As Long, c As Range, Adr As String, bsl As Date, bts As Double, d As Object, a1, a2, s, ay As String, t As Date
Set Si = Sheets("İzin İcmal")
Set St = Sheets("Liste")
With Application
.ScreenUpdating = False
.Calculation = xlManual
.EnableEvents = False
End With
Sheets("Puantaj").Select
son = Cells(Rows.Count, "A").End(xlUp).Row - 1
Range("E4:AI" & son).ClearContents
ay = WorksheetFunction.Proper(UCase(Replace(Replace([AJ2], "ı", "I"), "i", "İ")))
trh = DateSerial([AJ1], Month("1." & [AJ2] & "." & [AJ1]) + 1, 0)
gun = Day(trh)
For i = 4 To son
Cells(i, "E").Resize(1, gun) = "X"
For j = 5 To 35
t = Cells(3, j) & "." & [AJ2] & "." & [AJ1]
If Application.Weekday(CDate(t), 2) = 7 Then
Cells(i, j) = ""
End If
Next j
Set c = Si.[A:A].Find(Cells(i, "B"), , xlValues, xlWhole)
If Not c Is Nothing Then
Adr = c.Address
Do
bsl = Si.Cells(c.Row, "D")
bts = Si.Cells(c.Row, "E")
If Format(bsl, "MMMM") <> ay And Format(bts, "MMMM") <> ay Then Exit Do
If Si.Cells(c.Row, "F") > 0 Then
If Format(bsl, "MMMM") = ay And Format(bts, "MMMM") = ay Then
bsl = Day(bsl)
bts = Si.Cells(c.Row, "F")
ElseIf Format(bsl, "MMMM") <> ay And Format(bts, "MMMM") = ay Then
bsl = 1
bts = Day(bts)
Else
bts = trh - bsl + 1
bsl = Day(bsl)
End If
If WorksheetFunction.CountIf(Si.[L:L], Si.Cells(c.Row, "G")) > 0 Then
k = WorksheetFunction.Match(Si.Cells(c.Row, "G"), Si.[L:L], 0)
Cells(i, bsl + 4).Resize(1, bts) = Si.Cells(k, "M")
Else
Cells(i, bsl + 4).Resize(1, bts) = ""
End If
End If
Set c = Si.[A:A].FindNext(c)
Loop While Not c Is Nothing And c.Address <> Adr
End If
Next i
St.Range("A2:G" & Rows.Count).ClearContents
Range("A4").Resize(son - 3, 4).Copy
St.Range("A2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
St.Range("F2").Resize(son - 3, 1) = "3.BÖLGE"
For i = 2 To St.Cells(Rows.Count, "B").End(xlUp).Row
Set d = CreateObject("Scripting.Dictionary")
Set c = Si.[A:A].Find(St.Cells(i, "B"), , xlValues, xlWhole)
If Not c Is Nothing Then
Adr = c.Address
Do
deg = Si.Cells(c.Row, "G")
If Not d.exists(deg) Then
s = Si.Cells(c.Row, "F")
d.Add deg, s
Else
s = d.Item(deg)
s = s + Si.Cells(c.Row, "F")
d.Item(deg) = s
End If
Set c = Si.[A:A].FindNext(c)
Loop While Not c Is Nothing And c.Address <> Adr
End If
a1 = d.keys: a2 = d.items
For j = 0 To d.Count - 1
St.Cells(i, "G") = St.Cells(i, "G") & ", " & "(" & a2(j) & ")" & a1(j)
Next j
If St.Cells(i, "G") <> "" Then
St.Cells(i, "G") = Right(St.Cells(i, "G"), Len(St.Cells(i, "G")) - 2)
End If
Set d = Nothing
Next i
With Application
.Calculation = xlAutomatic
Range("AJ4").Resize(son - 3, 1).Copy
St.Range("E2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
.ScreenUpdating = True
.CutCopyMode = False
.EnableEvents = True
End With
End Sub
Sayın @aspavaÖmer Hocam , Bir şey fark ettim işe girişleri 1 gün sonrasında puantajda gösteriyor. Çıkışlarda sorun gözükmüyor.
Sub puantaj_aspava()
Dim Si As Worksheet, Sp As Worksheet, son As Long, ilk_t As Date, son_t As Date, gun As Byte, d As Range
Dim i As Long, c As Range, Adr As String, bsl As Date, bts As Double, k As Integer, j As Date, izn As String, ay As String
Set Si = Sheets("İzin İcmal")
Set Sp = Sheets("Pazar icmal")
With Application
.ScreenUpdating = False
.Calculation = xlManual
.EnableEvents = False
End With
Sheets("puantaj").Select
Range("G5:AK104").ClearContents
son = Cells(Rows.Count, "B").End(xlUp).Row
ay = WorksheetFunction.Proper(UCase(Replace(Replace([AD2], "ı", "I"), "i", "İ")))
ilk_t = CDate("1." & ay & "." & [AI2])
son_t = DateSerial([AI2], Month("1." & ay & "." & [AI2]) + 1, 0)
gun = Day(son_t)
For i = 5 To son
If Cells(i, "B") <> "" Then
Cells(i, "G").Resize(1, gun) = "X"
For k = 7 To 37
If Cells(3, k) = "Pazar" Then
Cells(i, k) = "HT"
End If
Next k
Set d = Sp.[A:A].Find(Cells(i, "B"), , xlFormulas, xlWhole)
If Not d Is Nothing Then
Adr = d.Address
Do
If Sp.Cells(d.Row, "C") >= ilk_t And Sp.Cells(d.Row, "C") <= son_t Then
Cells(i, Day(Sp.Cells(d.Row, "C")) + 6) = "X"
End If
Set d = Sp.[A:A].FindNext(d)
Loop While Not d Is Nothing And d.Address <> Adr
End If
If Cells(i, "F") >= ilk_t And Cells(i, "F") <= son_t And Cells(i, "F") <> "" And Day(Cells(i, "F")) <> 1 Then
Cells(i, "G").Resize(1, Day(Cells(i, "F")) - 1) = ""
End If
If Cells(i, "AL") >= ilk_t And Cells(i, "AL") <= son_t And Cells(i, "AL") <> "" Then
Cells(i, 7 + Day(Cells(i, "AL"))).Resize(1, son_t - Cells(i, "AL")) = ""
End If
Set c = Si.[A:A].Find(Cells(i, "B"), , xlFormulas, xlWhole)
If Not c Is Nothing Then
Adr = c.Address
Do
bsl = Si.Cells(c.Row, "C")
bts = Si.Cells(c.Row, "D")
If bts < ilk_t And bsl < ilk_t Then
Else
izn = ""
If WorksheetFunction.CountIf(Si.[K:K], Si.Cells(c.Row, "F")) > 0 Then
k = WorksheetFunction.Match(Si.Cells(c.Row, "F"), Si.[K:K], 0)
izn = Si.Cells(k, "L")
End If
If Si.Cells(c.Row, "E") > 0 Then
For j = ilk_t To son_t
If j >= bsl And j <= bts Then
Cells(i, Day(j) + 6) = izn
End If
Next j
End If
End If
Set c = Si.[A:A].FindNext(c)
Loop While Not c Is Nothing And c.Address <> Adr
End If
End If
Next i
With Application
.Calculation = xlAutomatic
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
Ömer Hocam , Teşekkür ederim. Ben denemelere devam ediyorum. Bir aksaklık gözüme çarparsa geri dönüş yaparım. Hocam emeğinize sağlık.Sayın @aspava
Detaylı deneme yapmadığım için bu tür aksaklıkları çıkabilir.
Deneyiniz.
Kod:Sub puantaj_aspava() Dim Si As Worksheet, Sp As Worksheet, trh As Date, gun As Byte, deg As String, j As Byte, Adr1 As String Dim i As Long, c As Range, Adr As String, bsl As Date, bts As Double, d As Range, k As Byte, ay As String Set Si = Sheets("İzin İcmal") Set Sp = Sheets("Pazar icmal") With Application .ScreenUpdating = False .Calculation = xlManual .EnableEvents = False End With Sheets("puantaj").Select Range("G5:AK104").ClearContents ay = WorksheetFunction.Proper(UCase(Replace(Replace([AD2], "ı", "I"), "i", "İ"))) trh = DateSerial([AI2], Month("1." & [AD2] & "." & [AI2]) + 1, 0) gun = Day(trh) For i = 5 To 104 Cells(i, "G").Resize(1, gun) = "X" For j = 7 To 37 If Cells(3, j) = "Pazar" Then Cells(i, j) = "HT" End If Next j Set d = Sp.[A:A].Find(Cells(i, "B"), , xlFormulas, xlWhole) If Not d Is Nothing Then Adr1 = d.Address Do If Format(Sp.Cells(d.Row, "C"), "MMMM") = ay Then Cells(i, Day(Sp.Cells(d.Row, "C")) + 6) = "X" End If Set d = Sp.[A:A].FindNext(d) Loop While Not d Is Nothing And d.Address <> Adr1 End If If Format(Cells(i, "F"), "MMMM") = ay And Cells(i, "F") <> "" And Day(Cells(i, "F")) <> 1 Then Cells(i, "G").Resize(1, Day(Cells(i, "F")) - 1) = "" End If If Format(Cells(i, "AL"), "MMMM") = ay And Cells(i, "AL") <> "" Then Cells(i, 7 + Day(Cells(i, "AL"))).Resize(1, trh - Cells(i, "AL")) = "" End If Set c = Si.[A:A].Find(Cells(i, "B"), , xlFormulas, xlWhole) If Not c Is Nothing Then Adr = c.Address Do bsl = Si.Cells(c.Row, "C") bts = Si.Cells(c.Row, "D") If Format(bsl, "MMMM") <> ay And Format(bts, "MMMM") <> ay Then Exit Do If Si.Cells(c.Row, "E") > 0 Then If Format(bsl, "MMMM") = ay And Format(bts, "MMMM") = ay Then bsl = Day(bsl) bts = Si.Cells(c.Row, "E") ElseIf Format(bsl, "MMMM") <> ay And Format(bts, "MMMM") = ay Then bsl = 1 bts = Day(bts) Else bts = trh - bsl + 1 bsl = Day(bsl) End If If WorksheetFunction.CountIf(Si.[K:K], Si.Cells(c.Row, "F")) > 0 Then k = WorksheetFunction.Match(Si.Cells(c.Row, "F"), Si.[K:K], 0) Cells(i, bsl + 6).Resize(1, bts) = Si.Cells(k, "L") Else Cells(i, bsl + 6).Resize(1, bts) = "" End If End If Set c = Si.[A:A].FindNext(c) Loop While Not c Is Nothing And c.Address <> Adr End If Next i With Application .Calculation = xlAutomatic .ScreenUpdating = True .EnableEvents = True End With End Sub
Sayın @aligunes
Deneyiniz.
Kod:Sub puantaj() Dim Si As Worksheet, St As Worksheet, son As Long, trh As Date, gun As Byte, deg As String, j As Integer, k As Byte Dim i As Long, c As Range, Adr As String, bsl As Date, bts As Double, d As Object, a1, a2, s, ay As String, t As Date Set Si = Sheets("İzin İcmal") Set St = Sheets("Liste") With Application .ScreenUpdating = False .Calculation = xlManual .EnableEvents = False End With Sheets("Puantaj").Select son = Cells(Rows.Count, "A").End(xlUp).Row - 1 Range("E4:AI" & son).ClearContents ay = WorksheetFunction.Proper(UCase(Replace(Replace([AJ2], "ı", "I"), "i", "İ"))) trh = DateSerial([AJ1], Month("1." & [AJ2] & "." & [AJ1]) + 1, 0) gun = Day(trh) For i = 4 To son Cells(i, "E").Resize(1, gun) = "X" For j = 5 To 35 t = Cells(3, j) & "." & [AJ2] & "." & [AJ1] If Application.Weekday(CDate(t), 2) = 7 Then Cells(i, j) = "" End If Next j Set c = Si.[A:A].Find(Cells(i, "B"), , xlValues, xlWhole) If Not c Is Nothing Then Adr = c.Address Do bsl = Si.Cells(c.Row, "D") bts = Si.Cells(c.Row, "E") If Format(bsl, "MMMM") <> ay And Format(bts, "MMMM") <> ay Then Exit Do If Si.Cells(c.Row, "F") > 0 Then If Format(bsl, "MMMM") = ay And Format(bts, "MMMM") = ay Then bsl = Day(bsl) bts = Si.Cells(c.Row, "F") ElseIf Format(bsl, "MMMM") <> ay And Format(bts, "MMMM") = ay Then bsl = 1 bts = Day(bts) Else bts = trh - bsl + 1 bsl = Day(bsl) End If If WorksheetFunction.CountIf(Si.[L:L], Si.Cells(c.Row, "G")) > 0 Then k = WorksheetFunction.Match(Si.Cells(c.Row, "G"), Si.[L:L], 0) Cells(i, bsl + 4).Resize(1, bts) = Si.Cells(k, "M") Else Cells(i, bsl + 4).Resize(1, bts) = "" End If End If Set c = Si.[A:A].FindNext(c) Loop While Not c Is Nothing And c.Address <> Adr End If Next i St.Range("A2:G" & Rows.Count).ClearContents Range("A4").Resize(son - 3, 4).Copy St.Range("A2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone St.Range("F2").Resize(son - 3, 1) = "3.BÖLGE" For i = 2 To St.Cells(Rows.Count, "B").End(xlUp).Row Set d = CreateObject("Scripting.Dictionary") Set c = Si.[A:A].Find(St.Cells(i, "B"), , xlValues, xlWhole) If Not c Is Nothing Then Adr = c.Address Do deg = Si.Cells(c.Row, "G") If Not d.exists(deg) Then s = Si.Cells(c.Row, "F") d.Add deg, s Else s = d.Item(deg) s = s + Si.Cells(c.Row, "F") d.Item(deg) = s End If Set c = Si.[A:A].FindNext(c) Loop While Not c Is Nothing And c.Address <> Adr End If a1 = d.keys: a2 = d.items For j = 0 To d.Count - 1 St.Cells(i, "G") = St.Cells(i, "G") & ", " & "(" & a2(j) & ")" & a1(j) Next j If St.Cells(i, "G") <> "" Then St.Cells(i, "G") = Right(St.Cells(i, "G"), Len(St.Cells(i, "G")) - 2) End If Set d = Nothing Next i With Application .Calculation = xlAutomatic Range("AJ4").Resize(son - 3, 1).Copy St.Range("E2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone .ScreenUpdating = True .CutCopyMode = False .EnableEvents = True End With End Sub
@Ömer hocam 26 nolu mesaj ekinde paylaştığım excel dosyasına kodları uyguladım. izin icmalin 146.sırasındaki 402926 sicilinSayın @aligunes
Deneyiniz.
Kod:Sub puantaj() Dim Si As Worksheet, St As Worksheet, son As Long, trh As Date, gun As Byte, deg As String, j As Integer, k As Byte Dim i As Long, c As Range, Adr As String, bsl As Date, bts As Double, d As Object, a1, a2, s, ay As String, t As Date Set Si = Sheets("İzin İcmal") Set St = Sheets("Liste") With Application .ScreenUpdating = False .Calculation = xlManual .EnableEvents = False End With Sheets("Puantaj").Select son = Cells(Rows.Count, "A").End(xlUp).Row - 1 Range("E4:AI" & son).ClearContents ay = WorksheetFunction.Proper(UCase(Replace(Replace([AJ2], "ı", "I"), "i", "İ"))) trh = DateSerial([AJ1], Month("1." & [AJ2] & "." & [AJ1]) + 1, 0) gun = Day(trh) For i = 4 To son Cells(i, "E").Resize(1, gun) = "X" For j = 5 To 35 t = Cells(3, j) & "." & [AJ2] & "." & [AJ1] If Application.Weekday(CDate(t), 2) = 7 Then Cells(i, j) = "" End If Next j Set c = Si.[A:A].Find(Cells(i, "B"), , xlValues, xlWhole) If Not c Is Nothing Then Adr = c.Address Do bsl = Si.Cells(c.Row, "D") bts = Si.Cells(c.Row, "E") If Format(bsl, "MMMM") <> ay And Format(bts, "MMMM") <> ay Then Exit Do If Si.Cells(c.Row, "F") > 0 Then If Format(bsl, "MMMM") = ay And Format(bts, "MMMM") = ay Then bsl = Day(bsl) bts = Si.Cells(c.Row, "F") ElseIf Format(bsl, "MMMM") <> ay And Format(bts, "MMMM") = ay Then bsl = 1 bts = Day(bts) Else bts = trh - bsl + 1 bsl = Day(bsl) End If If WorksheetFunction.CountIf(Si.[L:L], Si.Cells(c.Row, "G")) > 0 Then k = WorksheetFunction.Match(Si.Cells(c.Row, "G"), Si.[L:L], 0) Cells(i, bsl + 4).Resize(1, bts) = Si.Cells(k, "M") Else Cells(i, bsl + 4).Resize(1, bts) = "" End If End If Set c = Si.[A:A].FindNext(c) Loop While Not c Is Nothing And c.Address <> Adr End If Next i St.Range("A2:G" & Rows.Count).ClearContents Range("A4").Resize(son - 3, 4).Copy St.Range("A2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone St.Range("F2").Resize(son - 3, 1) = "3.BÖLGE" For i = 2 To St.Cells(Rows.Count, "B").End(xlUp).Row Set d = CreateObject("Scripting.Dictionary") Set c = Si.[A:A].Find(St.Cells(i, "B"), , xlValues, xlWhole) If Not c Is Nothing Then Adr = c.Address Do deg = Si.Cells(c.Row, "G") If Not d.exists(deg) Then s = Si.Cells(c.Row, "F") d.Add deg, s Else s = d.Item(deg) s = s + Si.Cells(c.Row, "F") d.Item(deg) = s End If Set c = Si.[A:A].FindNext(c) Loop While Not c Is Nothing And c.Address <> Adr End If a1 = d.keys: a2 = d.items For j = 0 To d.Count - 1 St.Cells(i, "G") = St.Cells(i, "G") & ", " & "(" & a2(j) & ")" & a1(j) Next j If St.Cells(i, "G") <> "" Then St.Cells(i, "G") = Right(St.Cells(i, "G"), Len(St.Cells(i, "G")) - 2) End If Set d = Nothing Next i With Application .Calculation = xlAutomatic Range("AJ4").Resize(son - 3, 1).Copy St.Range("E2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone .ScreenUpdating = True .CutCopyMode = False .EnableEvents = True End With End Sub
18.06.2020 | 15.09.2020 | 90 | Refakat İzni |
Sub puantaj()
Dim Si As Worksheet, St As Worksheet, son As Long, ilk_t As Date, son_t As Date, gun As Byte
Dim i As Long, c As Range, Adr As String, bsl As Date, bts As Double, k As Integer, j As Date, izn As String
Dim d As Object, a1, a2, s, deg As String, sure As Double, ay As String
Set Si = Sheets("İzin İcmal")
Set St = Sheets("Liste")
With Application
.ScreenUpdating = False
.Calculation = xlManual
.EnableEvents = False
End With
sure = Timer
Sheets("Puantaj").Select
Range("E4:AI203").ClearContents
son = Cells(Rows.Count, "A").End(xlUp).Row - 1
ay = WorksheetFunction.Proper(UCase(Replace(Replace([AJ2], "ı", "I"), "i", "İ")))
ilk_t = CDate("1." & ay & "." & [AJ1])
son_t = DateSerial([AJ1], Month("1." & ay & "." & [AJ1]) + 1, 0)
gun = Day(son_t)
For i = 4 To 203
If Cells(i, "B") <> "" Then
Cells(i, "E").Resize(1, gun) = "X"
For j = ilk_t To son_t
If Application.Weekday(j, 2) = 7 Then
Cells(i, Day(j) + 4) = ""
End If
Next j
Set c = Si.[A:A].Find(Cells(i, "B"), , xlValues, xlWhole)
If Not c Is Nothing Then
Adr = c.Address
Do
bsl = Si.Cells(c.Row, "D")
bts = Si.Cells(c.Row, "E")
If bts < ilk_t And bsl < ilk_t Then
Else
izn = ""
If WorksheetFunction.CountIf(Si.[L:L], Si.Cells(c.Row, "G")) > 0 Then
k = WorksheetFunction.Match(Si.Cells(c.Row, "G"), Si.[L:L], 0)
izn = Si.Cells(k, "M")
End If
If Si.Cells(c.Row, "F") > 0 Then
For j = ilk_t To son_t
If j >= bsl And j <= bts Then
Cells(i, Day(j) + 4) = izn
End If
Next j
End If
End If
Set c = Si.[A:A].FindNext(c)
Loop While Not c Is Nothing And c.Address <> Adr
End If
End If
Next i
St.Range("A2:G" & Rows.Count).ClearContents
Range("A4").Resize(son - 3, 4).Copy
St.Range("A2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
St.Range("F2").Resize(son - 3, 1) = "3.BÖLGE"
For i = 2 To St.Cells(Rows.Count, "B").End(xlUp).Row
Set d = CreateObject("Scripting.Dictionary")
Set c = Si.[A:A].Find(St.Cells(i, "B"), , xlValues, xlWhole)
If Not c Is Nothing Then
Adr = c.Address
Do
deg = Si.Cells(c.Row, "G")
If Not d.exists(deg) Then
s = Si.Cells(c.Row, "F")
d.Add deg, s
Else
s = d.Item(deg)
s = s + Si.Cells(c.Row, "F")
d.Item(deg) = s
End If
Set c = Si.[A:A].FindNext(c)
Loop While Not c Is Nothing And c.Address <> Adr
End If
a1 = d.keys: a2 = d.items
For k = 0 To d.Count - 1
St.Cells(i, "G") = St.Cells(i, "G") & ", " & "(" & a2(k) & ")" & a1(k)
Next k
If St.Cells(i, "G") <> "" Then
St.Cells(i, "G") = Right(St.Cells(i, "G"), Len(St.Cells(i, "G")) - 2)
End If
Set d = Nothing
Next i
With Application
.Calculation = xlAutomatic
Range("AJ4").Resize(son - 3, 1).Copy
St.Range("E2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
.ScreenUpdating = True
.CutCopyMode = False
.EnableEvents = True
End With
MsgBox "İşlem Süresi --- " & Format(Timer - sure, "0.00")
End Sub
Boş mu bırakması gerekiyor. Ayrıca resmi tatilleri yazdığınız bir bölüm olmalı. Buna uygun dosya eklerseniz dosya üzerinden bakalım.Ömer Hocam , Kontrol ettim diğerinde kullandığı izin süresinde "X" koyuyordu şimdi tarih aralığında koyuyor daha sağlıklı oldu. Sizi uğraştırmayacak ise eğer izin tarihi aralığında Pazar gününe Yada Resmi Tatile gelen güne izinli yazmasak olur mu ?
@Ömer hocam örneklerle anlatmaya çalıştım.Ay hatası için #32 numaralı mesajı güncelledim, tekrar deneyiniz. (Küçük büyük harf dil probleminden dolayı)
Hızla ilgili bende bir sorun olmadı. Bende 1 sn. altında hesapladı. Diğer sorunuzu tam anlayamadım, sicil numarası vererek daha detaylı açıklar mısınız.
Ekli dosyayı görüntüle 220004