- Katılım
- 30 Kasım 2006
- Mesajlar
- 411
- Excel Vers. ve Dili
- Excel 2007 - Türkçe
Sayı değer hocalarım..
Kurumumuzda çalışan üç yüzün üzerinde çalışan personelimiz mevcut. Personelimize ay ay çalıştığı ve geçici görevli olduğu gün sayısınca ek ödeme yapılabilmesi için, UserForm alt tabanında ekte mevcut örnek tabloya benzer bir sayfam mevcut, Bu Sayfada işlem yapmak üzere oluşturduğum, her satır için ayrı ayrı yazılan;
Private Sub CommandButton1_Click()
'PERSONELİN AYLIK ÇALIŞTIĞI GÜNLER (KIRMIZI - İZİN, SARI - GEÇİCİ GÖREV, MAVİ - RAPORLU GÜNLER)
Dim Hucre As Range
Dim Kriter As Range
Range("BP2:BZ100").ClearContents
'C Sütununda kayıtlı dolu satıra göre
For Each Hucre In Range("D2:AH2")' 2. SATIR
If Hucre.Interior.ColorIndex = 6 Then
Sonuc = Sonuc + 1
End If
If Hucre.Interior.ColorIndex = 3 Then
Sonuc1 = Sonuc1 + 1
End If
If Hucre.Interior.ColorIndex = 5 Then
Sonuc2 = Sonuc2 + 1
End If
Next Hucre
Cells(2, "BP").Value = Sonuc
Cells(2, "BQ").Value = Sonuc1
Cells(2, "BR").Value = Sonuc2
'---------------------------------------------------------
For Each Hucre In Range("D3:AH3")' 3. SATIR
If Hucre.Interior.ColorIndex = 6 Then
Sonuc3 = Sonuc3 + 1
End If
If Hucre.Interior.ColorIndex = 3 Then
Sonuc4 = Sonuc4 + 1
End If
If Hucre.Interior.ColorIndex = 5 Then
Sonuc5 = Sonuc5 + 1
End If
Next Hucre
Cells(3, "BP").Value = Sonuc3
Cells(3, "BQ").Value = Sonuc4
Cells(3, "BR").Value = Sonuc5
'---------------------------------------------------------
For Each Hucre In Range("D4:AH4")' 4. SATIR
If Hucre.Interior.ColorIndex = 6 Then
Sonuc6 = Sonuc6 + 1
End If
If Hucre.Interior.ColorIndex = 3 Then
Sonuc7 = Sonuc7 + 1
End If
If Hucre.Interior.ColorIndex = 5 Then
Sonuc8 = Sonuc8 + 1
End If
Next Hucre
Cells(4, "BP").Value = Sonuc6
Cells(4, "BQ").Value = Sonuc7
Cells(4, "BR").Value = Sonuc8
'....................................son dolu satıra kadar
'2. Ay---XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
For Each Hucre In Range("AI2:BM2")' 2. SATIR
If Hucre.Interior.ColorIndex = 6 Then
Sonuc9 = Sonuc9 + 1
End If
If Hucre.Interior.ColorIndex = 3 Then
Sonuc10 = Sonuc10 + 1
End If
If Hucre.Interior.ColorIndex = 5 Then
Sonuc11 = Sonuc11 + 1
End If
Next Hucre
Cells(2, "BT").Value = Sonuc9
Cells(2, "BU").Value = Sonuc10
Cells(2, "BV").Value = Sonuc11
'-----------------------------------------------------
For Each Hucre In Range("AI3:BM3")' 3. SATIR
If Hucre.Interior.ColorIndex = 6 Then
Sonuc12 = Sonuc12 + 1
End If
If Hucre.Interior.ColorIndex = 3 Then
Sonuc13 = Sonuc13 + 1
End If
If Hucre.Interior.ColorIndex = 5 Then
Sonuc14 = Sonuc14 + 1
End If
Next Hucre
Cells(3, "BT").Value = Sonuc12
Cells(3, "BU").Value = Sonuc13
Cells(3, "BV").Value = Sonuc14
'-----------------------------------------------------
For Each Hucre In Range("AI4:BM4")' 4. SATIR
If Hucre.Interior.ColorIndex = 6 Then
Sonuc15 = Sonuc15 + 1
End If
If Hucre.Interior.ColorIndex = 3 Then
Sonuc16 = Sonuc16 + 1
End If
If Hucre.Interior.ColorIndex = 5 Then
Sonuc17 = Sonuc17 + 1
End If
Next Hucre
Cells(4, "BT").Value = Sonuc15
Cells(4, "BU").Value = Sonuc16
Cells(4, "BV").Value = Sonuc17
'....................................son dolu satıra kadar
'3. Ay--- Tablo 1 Yıl olarak devam ediyor XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
End Sub
Tüm yıla uygulanmak üzere daha pratik bu kodu nasıl düzenlemeliyim......
Kurumumuzda çalışan üç yüzün üzerinde çalışan personelimiz mevcut. Personelimize ay ay çalıştığı ve geçici görevli olduğu gün sayısınca ek ödeme yapılabilmesi için, UserForm alt tabanında ekte mevcut örnek tabloya benzer bir sayfam mevcut, Bu Sayfada işlem yapmak üzere oluşturduğum, her satır için ayrı ayrı yazılan;
Private Sub CommandButton1_Click()
'PERSONELİN AYLIK ÇALIŞTIĞI GÜNLER (KIRMIZI - İZİN, SARI - GEÇİCİ GÖREV, MAVİ - RAPORLU GÜNLER)
Dim Hucre As Range
Dim Kriter As Range
Range("BP2:BZ100").ClearContents
'C Sütununda kayıtlı dolu satıra göre
For Each Hucre In Range("D2:AH2")' 2. SATIR
If Hucre.Interior.ColorIndex = 6 Then
Sonuc = Sonuc + 1
End If
If Hucre.Interior.ColorIndex = 3 Then
Sonuc1 = Sonuc1 + 1
End If
If Hucre.Interior.ColorIndex = 5 Then
Sonuc2 = Sonuc2 + 1
End If
Next Hucre
Cells(2, "BP").Value = Sonuc
Cells(2, "BQ").Value = Sonuc1
Cells(2, "BR").Value = Sonuc2
'---------------------------------------------------------
For Each Hucre In Range("D3:AH3")' 3. SATIR
If Hucre.Interior.ColorIndex = 6 Then
Sonuc3 = Sonuc3 + 1
End If
If Hucre.Interior.ColorIndex = 3 Then
Sonuc4 = Sonuc4 + 1
End If
If Hucre.Interior.ColorIndex = 5 Then
Sonuc5 = Sonuc5 + 1
End If
Next Hucre
Cells(3, "BP").Value = Sonuc3
Cells(3, "BQ").Value = Sonuc4
Cells(3, "BR").Value = Sonuc5
'---------------------------------------------------------
For Each Hucre In Range("D4:AH4")' 4. SATIR
If Hucre.Interior.ColorIndex = 6 Then
Sonuc6 = Sonuc6 + 1
End If
If Hucre.Interior.ColorIndex = 3 Then
Sonuc7 = Sonuc7 + 1
End If
If Hucre.Interior.ColorIndex = 5 Then
Sonuc8 = Sonuc8 + 1
End If
Next Hucre
Cells(4, "BP").Value = Sonuc6
Cells(4, "BQ").Value = Sonuc7
Cells(4, "BR").Value = Sonuc8
'....................................son dolu satıra kadar
'2. Ay---XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
For Each Hucre In Range("AI2:BM2")' 2. SATIR
If Hucre.Interior.ColorIndex = 6 Then
Sonuc9 = Sonuc9 + 1
End If
If Hucre.Interior.ColorIndex = 3 Then
Sonuc10 = Sonuc10 + 1
End If
If Hucre.Interior.ColorIndex = 5 Then
Sonuc11 = Sonuc11 + 1
End If
Next Hucre
Cells(2, "BT").Value = Sonuc9
Cells(2, "BU").Value = Sonuc10
Cells(2, "BV").Value = Sonuc11
'-----------------------------------------------------
For Each Hucre In Range("AI3:BM3")' 3. SATIR
If Hucre.Interior.ColorIndex = 6 Then
Sonuc12 = Sonuc12 + 1
End If
If Hucre.Interior.ColorIndex = 3 Then
Sonuc13 = Sonuc13 + 1
End If
If Hucre.Interior.ColorIndex = 5 Then
Sonuc14 = Sonuc14 + 1
End If
Next Hucre
Cells(3, "BT").Value = Sonuc12
Cells(3, "BU").Value = Sonuc13
Cells(3, "BV").Value = Sonuc14
'-----------------------------------------------------
For Each Hucre In Range("AI4:BM4")' 4. SATIR
If Hucre.Interior.ColorIndex = 6 Then
Sonuc15 = Sonuc15 + 1
End If
If Hucre.Interior.ColorIndex = 3 Then
Sonuc16 = Sonuc16 + 1
End If
If Hucre.Interior.ColorIndex = 5 Then
Sonuc17 = Sonuc17 + 1
End If
Next Hucre
Cells(4, "BT").Value = Sonuc15
Cells(4, "BU").Value = Sonuc16
Cells(4, "BV").Value = Sonuc17
'....................................son dolu satıra kadar
'3. Ay--- Tablo 1 Yıl olarak devam ediyor XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
End Sub
Tüm yıla uygulanmak üzere daha pratik bu kodu nasıl düzenlemeliyim......
