- Katılım
- 4 Ekim 2004
- Mesajlar
- 155
bir "PEDIZ" Adlı çalışma sayfasında e3:e600 arası ocak-ağustos günlük verileri
ile e:602:e1200 arası eylül aralık günlük verileri var...
ve form üzerinde txtilktar adlı textbox1 ile txtsontar textbox2 'ye başlangıç (txtilktar) ve bitiş (txtsontar) tarihleri girilmesi isteniyor.
KOYU RENKLE İÃARETLENEN KODLAR ÇALIÃIYOR YANİ SAYFAYA E3:E600 ARASI VERİ GİRİÃİNDE SORUN YOK.
---> ANCAK BAÃLANGIÇ BİTİÃ TARİHLERİNİ EYLÜL ARALIK AYI BİR TARİH GİRDİÃİM ZAMAN (Bkz.Koyu renkli olmayan 2.kısım kodları) GİRDİÃİM Haftatatiline (HFİZ) DENK GELEN GÜN Ã?RNEÃİN SALI İSE HEP 2 GÜN Ã?NCEKİ TARİHİ ALGILIYOR VE GÜNÜ PAZAR OLARAK GÃ?STERİYOR.?? :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa:
Sheets("PEDİZ").Select
If Month(txtilktar) < 9 Then
' Aranan ismin satır sayısını bulur.
With Range("E3:E600")
Set c = .Find(adi, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
satir = c.Row
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
sontar = IIf(Month(txtsontar) > 8, DateSerial(Year(txtsontar), 8, 31), DateValue(txtsontar))
' txtilktar'in Kaçıncı gün olduğunu bulur ve üzerine G sütunu kadar (7) ekler
sutun1 = (DateValue(txtilktar) - DateSerial(Year(txtsontar) - 1, 12, 31)) + 7
' txtsontar'in Kaçıncı gün olduğunu bulur ve üzerine G sütunu kadar (7) ekler
sutun2 = (sontar - DateSerial(Year(txtsontar) - 1, 12, 31)) + 7
If Buton <> "HFİZ" Then 'HFİZ'den farklıysa
If WorksheetFunction.CountIf(Range(Cells(satir, sutun1), Cells(satir, sutun2)), Buton) Then
MsgBox txtilktar & "-" & txtsontar & " tarihleri arasında önceden veri girişi var": Exit Sub
End If
If sec = 1 Then 'Buton grup1'in içindeye
sutun2 = sutun2 + WorksheetFunction.CountIf(Range(Cells(satir, sutun1), Cells(satir, sutun2)), "HFİZ")
Else: sutun2 = sutun2 'Buton grup2'nin içindeye
End If
For i = sutun1 To sutun2
geridon:
If Cells(satir, i) = "Rİ" And Buton = "Yİ" Then i = i + 1: GoTo geridon
If Cells(satir, i) = "Yİ" And Buton = "Rİ" Then i = i + 1: GoTo geridon
If Cells(satir, i) = "HFİZ" And sec = 2 Then i = i + 1: GoTo geridon
If Cells(satir, i) <> Empty And Cells(satir, i) <> "HFİZ" Then MsgBox (DateValue(Cells(2, i)) & " tarihinde " & Cells(satir, i) & " Girişi Mevcut !"): Exit Sub
Next
For i = sutun1 To sutun2
If Cells(satir, i) = "Rİ" And Buton = "Yİ" Then Cells(satir, i) = Empty
If Cells(satir, i) = "Yİ" And Buton = "Rİ" Then Cells(satir, i) = Empty
If Cells(satir, i) = "HFİZ" And sec = 2 Then Cells(satir, i) = Empty
If Cells(satir, i) = "HFİZ" And WorksheetFunction.Weekday(Cells(2, i), 2) <> 7 And Buton = "Yİ" Then Cells(satir, i) = Empty
If WorksheetFunction.Weekday(Cells(2, i), 2) = 7 And Buton = "Yİ" Then Cells(satir, i) = "HFİZ"
If Cells(satir, i) = Empty Then Cells(satir, i) = Buton & TextBox1
Next
Else 'HFİZ ise ComboBox1'de seçilen günün seçilen tarihteki günler HFİZ diye işler
For i = sutun1 To sutun2 'ComboBox1'de seçilen günü, Girdiğiniz tarih aralığındaki ilkini bulur
If WorksheetFunction.Weekday(Cells(2, i), 2) = ComboBox1.ListIndex + 1 Then tmpsat = i: Exit For
Next
For i = tmpsat To sutun2 Step 7 'Bulduğu ilk günden girdiğiniz son tarihe kadar bulduğu o güne "HFİZ" yazar.
If Cells(satir, i) <> "Yİ" Then Cells(satir, i) = Buton
Next
Cells(satir, "G") = ComboBox1
End If
sutun1 = 0: sutun2 = 0: satir = 0
End If
>>>>>>>>>>>>>Sorun Aşağıdaki Kod ve devamında.üstteki kodlar (ocak-ağustos verilerinde problem yok
If Month(txtsontar) > 8 Then
With Range("E602:E1200")
Set c = .Find(adi, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
satir = c.Row
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
' DİKKAT!!!
<<<<BÜYÜK İHTİMAL SORUN AÃAÃIDAKİ KOYU RENKLİ RAKAM İÇEREN KODLARDA...ÇÜNKÜ HEP 2 GÜN Ã?NCENİN GÜNLERİNİ VERİYOR BANA BURADAKİ BİR RAKAIMI 2 EKSİLTMEK VEYA ARTTIRMAK LAZIM DİYE DÜÃÜNÜYORUM SADECE BİR Ã?NSEZİ.HAKLI MIYIM??
' txtilktar'in Kaçıncı gün olduğunu bulur ve üzerine G sütunu kadar (7) ekler. Eğer 9.aydan küçükse 8.sütunu bulur.
sutun1 = IIf(Month(txtilktar) < 9, 8, (DateValue(txtilktar) - DateSerial(Year(txtsontar), 8, 31)) + 7)
' txtsontar'in Kaçıncı gün olduğunu bulur ve üzerine G sütunu kadar (7) ekler
sutun2 = (DateValue(txtsontar) - DateSerial(Year(txtsontar), 8, 31)) + 7
If Buton <> "HFİZ" Then 'HFİZ'den farklıysa
If WorksheetFunction.CountIf(Range(Cells(satir, sutun1), Cells(satir, sutun2)), Buton) Then
MsgBox txtilktar & "-" & txtsontar & " tarihleri arasında önceden veri girişi var": Exit Sub
End If
If sec = 1 Then 'Buton grup1'in içindeye
sutun2 = sutun2 + WorksheetFunction.CountIf(Range(Cells(satir, sutun1), Cells(satir, sutun2)), "HFİZ")
Else: sutun2 = sutun2 'Buton grup2'nin içindeye
End If
For i = sutun1 To sutun2
geridon2:
If Cells(satir, i) = "Rİ" And Buton = "Yİ" Then i = i + 1: GoTo geridon2
If Cells(satir, i) = "Yİ" And Buton = "Rİ" Then i = i + 1: GoTo geridon2
If Cells(satir, i) = "HFİZ" And sec = 2 Then i = i + 1: GoTo geridon2
If Cells(satir, i) <> Empty And Cells(satir, i) <> "HFİZ" Then MsgBox (DateValue(Cells(2, i)) & " tarihinde " & Cells(satir, i) & " Girişi Mevcut !"): Exit Sub
Next
For i = sutun1 To sutun2
If Cells(satir, i) = "Rİ" And Buton = "Yİ" Then Cells(satir, i) = Empty
If Cells(satir, i) = "Yİ" And Buton = "Rİ" Then Cells(satir, i) = Empty
If Cells(satir, i) = "HFİZ" And sec = 2 Then Cells(satir, i) = Empty
If Cells(satir, i) = "HFİZ" And WorksheetFunction.Weekday(Cells(2, i), 2) <> 7 And Buton = "Yİ" Then Cells(satir, i) = Empty
If WorksheetFunction.Weekday(Cells(2, i), 2) = 7 And Buton = "Yİ" Then Cells(satir, i) = "HFİZ"
If Cells(satir, i) = Empty Then Cells(satir, i) = Buton & TextBox1
Next
Else 'HFİZ ise ComboBox1'de seçilen günün seçilen tarihteki günler HFİZ diye işler
For i = sutun1 To sutun2 'ComboBox1'de seçilen günü, Girdiğiniz tarih aralığındaki ilkini bulur
If WorksheetFunction.Weekday(Cells(2, i), 2) = ComboBox1.ListIndex + 1 Then tmpsat = i: Exit For
Next
For i = tmpsat To sutun2 Step 7 'Bulduğu ilk günden girdiğiniz son tarihe kadar bulduğu o güne "HFİZ" yazar.
If Cells(satir, i) <> "Yİ" Then Cells(satir, i) = Buton
Next
Cells(satir, "G") = ComboBox1
End If
End If
MsgBox ("Veri Kaydedildi...")
ile e:602:e1200 arası eylül aralık günlük verileri var...
ve form üzerinde txtilktar adlı textbox1 ile txtsontar textbox2 'ye başlangıç (txtilktar) ve bitiş (txtsontar) tarihleri girilmesi isteniyor.
KOYU RENKLE İÃARETLENEN KODLAR ÇALIÃIYOR YANİ SAYFAYA E3:E600 ARASI VERİ GİRİÃİNDE SORUN YOK.
---> ANCAK BAÃLANGIÇ BİTİÃ TARİHLERİNİ EYLÜL ARALIK AYI BİR TARİH GİRDİÃİM ZAMAN (Bkz.Koyu renkli olmayan 2.kısım kodları) GİRDİÃİM Haftatatiline (HFİZ) DENK GELEN GÜN Ã?RNEÃİN SALI İSE HEP 2 GÜN Ã?NCEKİ TARİHİ ALGILIYOR VE GÜNÜ PAZAR OLARAK GÃ?STERİYOR.?? :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa: :kafa:
Sheets("PEDİZ").Select
If Month(txtilktar) < 9 Then
' Aranan ismin satır sayısını bulur.
With Range("E3:E600")
Set c = .Find(adi, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
satir = c.Row
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
sontar = IIf(Month(txtsontar) > 8, DateSerial(Year(txtsontar), 8, 31), DateValue(txtsontar))
' txtilktar'in Kaçıncı gün olduğunu bulur ve üzerine G sütunu kadar (7) ekler
sutun1 = (DateValue(txtilktar) - DateSerial(Year(txtsontar) - 1, 12, 31)) + 7
' txtsontar'in Kaçıncı gün olduğunu bulur ve üzerine G sütunu kadar (7) ekler
sutun2 = (sontar - DateSerial(Year(txtsontar) - 1, 12, 31)) + 7
If Buton <> "HFİZ" Then 'HFİZ'den farklıysa
If WorksheetFunction.CountIf(Range(Cells(satir, sutun1), Cells(satir, sutun2)), Buton) Then
MsgBox txtilktar & "-" & txtsontar & " tarihleri arasında önceden veri girişi var": Exit Sub
End If
If sec = 1 Then 'Buton grup1'in içindeye
sutun2 = sutun2 + WorksheetFunction.CountIf(Range(Cells(satir, sutun1), Cells(satir, sutun2)), "HFİZ")
Else: sutun2 = sutun2 'Buton grup2'nin içindeye
End If
For i = sutun1 To sutun2
geridon:
If Cells(satir, i) = "Rİ" And Buton = "Yİ" Then i = i + 1: GoTo geridon
If Cells(satir, i) = "Yİ" And Buton = "Rİ" Then i = i + 1: GoTo geridon
If Cells(satir, i) = "HFİZ" And sec = 2 Then i = i + 1: GoTo geridon
If Cells(satir, i) <> Empty And Cells(satir, i) <> "HFİZ" Then MsgBox (DateValue(Cells(2, i)) & " tarihinde " & Cells(satir, i) & " Girişi Mevcut !"): Exit Sub
Next
For i = sutun1 To sutun2
If Cells(satir, i) = "Rİ" And Buton = "Yİ" Then Cells(satir, i) = Empty
If Cells(satir, i) = "Yİ" And Buton = "Rİ" Then Cells(satir, i) = Empty
If Cells(satir, i) = "HFİZ" And sec = 2 Then Cells(satir, i) = Empty
If Cells(satir, i) = "HFİZ" And WorksheetFunction.Weekday(Cells(2, i), 2) <> 7 And Buton = "Yİ" Then Cells(satir, i) = Empty
If WorksheetFunction.Weekday(Cells(2, i), 2) = 7 And Buton = "Yİ" Then Cells(satir, i) = "HFİZ"
If Cells(satir, i) = Empty Then Cells(satir, i) = Buton & TextBox1
Next
Else 'HFİZ ise ComboBox1'de seçilen günün seçilen tarihteki günler HFİZ diye işler
For i = sutun1 To sutun2 'ComboBox1'de seçilen günü, Girdiğiniz tarih aralığındaki ilkini bulur
If WorksheetFunction.Weekday(Cells(2, i), 2) = ComboBox1.ListIndex + 1 Then tmpsat = i: Exit For
Next
For i = tmpsat To sutun2 Step 7 'Bulduğu ilk günden girdiğiniz son tarihe kadar bulduğu o güne "HFİZ" yazar.
If Cells(satir, i) <> "Yİ" Then Cells(satir, i) = Buton
Next
Cells(satir, "G") = ComboBox1
End If
sutun1 = 0: sutun2 = 0: satir = 0
End If
>>>>>>>>>>>>>Sorun Aşağıdaki Kod ve devamında.üstteki kodlar (ocak-ağustos verilerinde problem yok
If Month(txtsontar) > 8 Then
With Range("E602:E1200")
Set c = .Find(adi, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
satir = c.Row
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
' DİKKAT!!!
<<<<BÜYÜK İHTİMAL SORUN AÃAÃIDAKİ KOYU RENKLİ RAKAM İÇEREN KODLARDA...ÇÜNKÜ HEP 2 GÜN Ã?NCENİN GÜNLERİNİ VERİYOR BANA BURADAKİ BİR RAKAIMI 2 EKSİLTMEK VEYA ARTTIRMAK LAZIM DİYE DÜÃÜNÜYORUM SADECE BİR Ã?NSEZİ.HAKLI MIYIM??
' txtilktar'in Kaçıncı gün olduğunu bulur ve üzerine G sütunu kadar (7) ekler. Eğer 9.aydan küçükse 8.sütunu bulur.
sutun1 = IIf(Month(txtilktar) < 9, 8, (DateValue(txtilktar) - DateSerial(Year(txtsontar), 8, 31)) + 7)
' txtsontar'in Kaçıncı gün olduğunu bulur ve üzerine G sütunu kadar (7) ekler
sutun2 = (DateValue(txtsontar) - DateSerial(Year(txtsontar), 8, 31)) + 7
If Buton <> "HFİZ" Then 'HFİZ'den farklıysa
If WorksheetFunction.CountIf(Range(Cells(satir, sutun1), Cells(satir, sutun2)), Buton) Then
MsgBox txtilktar & "-" & txtsontar & " tarihleri arasında önceden veri girişi var": Exit Sub
End If
If sec = 1 Then 'Buton grup1'in içindeye
sutun2 = sutun2 + WorksheetFunction.CountIf(Range(Cells(satir, sutun1), Cells(satir, sutun2)), "HFİZ")
Else: sutun2 = sutun2 'Buton grup2'nin içindeye
End If
For i = sutun1 To sutun2
geridon2:
If Cells(satir, i) = "Rİ" And Buton = "Yİ" Then i = i + 1: GoTo geridon2
If Cells(satir, i) = "Yİ" And Buton = "Rİ" Then i = i + 1: GoTo geridon2
If Cells(satir, i) = "HFİZ" And sec = 2 Then i = i + 1: GoTo geridon2
If Cells(satir, i) <> Empty And Cells(satir, i) <> "HFİZ" Then MsgBox (DateValue(Cells(2, i)) & " tarihinde " & Cells(satir, i) & " Girişi Mevcut !"): Exit Sub
Next
For i = sutun1 To sutun2
If Cells(satir, i) = "Rİ" And Buton = "Yİ" Then Cells(satir, i) = Empty
If Cells(satir, i) = "Yİ" And Buton = "Rİ" Then Cells(satir, i) = Empty
If Cells(satir, i) = "HFİZ" And sec = 2 Then Cells(satir, i) = Empty
If Cells(satir, i) = "HFİZ" And WorksheetFunction.Weekday(Cells(2, i), 2) <> 7 And Buton = "Yİ" Then Cells(satir, i) = Empty
If WorksheetFunction.Weekday(Cells(2, i), 2) = 7 And Buton = "Yİ" Then Cells(satir, i) = "HFİZ"
If Cells(satir, i) = Empty Then Cells(satir, i) = Buton & TextBox1
Next
Else 'HFİZ ise ComboBox1'de seçilen günün seçilen tarihteki günler HFİZ diye işler
For i = sutun1 To sutun2 'ComboBox1'de seçilen günü, Girdiğiniz tarih aralığındaki ilkini bulur
If WorksheetFunction.Weekday(Cells(2, i), 2) = ComboBox1.ListIndex + 1 Then tmpsat = i: Exit For
Next
For i = tmpsat To sutun2 Step 7 'Bulduğu ilk günden girdiğiniz son tarihe kadar bulduğu o güne "HFİZ" yazar.
If Cells(satir, i) <> "Yİ" Then Cells(satir, i) = Buton
Next
Cells(satir, "G") = ComboBox1
End If
End If
MsgBox ("Veri Kaydedildi...")