• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Bilgileri Güncelleme Hatası

Katılım
8 Mart 2007
Mesajlar
34
Excel Vers. ve Dili
2003 türkçe
Arkadaşlar aşağıdaki kodlarla kayıtları güncelleme yaparken aynı kayıttan iki tane oluşuyor.Yardımcı olursanız sevinirim.


Private Sub CommandButton2_Click()
sor = MsgBox("Değiştirmek istediğinizden eminmisiniz?", vbYesNo)
If sor = vbNo Then Exit Sub
CommandButton2.Caption = " DEĞİŞTİRİLDİ"
CommandButton2.Caption = " DEĞİŞTİR"
sonsat = ListBox1.ListIndex + 2
Cells(sonsat, 1) = tcno
Cells(sonsat, 2) = adı
Cells(sonsat, 3) = soyadı
Cells(sonsat, 4) = bölümü
Cells(sonsat, 5) = sınıfşube
Cells(sonsat, 6) = okulno
Cells(sonsat, 7) = doğumyeri
Cells(sonsat, 8) = doğumtarihi
Cells(sonsat, 9) = evtlfno
Cells(sonsat, 10) = cepno
Cells(sonsat, 11) = evadresi
Cells(sonsat, 12) = kardeşsayısı
Cells(sonsat, 13) = babaadı
Cells(sonsat, 14) = babamesleği
Cells(sonsat, 15) = babaceptlfno
Cells(sonsat, 16) = babasağmı
Cells(sonsat, 17) = babamaaşı
Cells(sonsat, 18) = anneadı
Cells(sonsat, 19) = annemesleği
Cells(sonsat, 20) = anneceptlfno
Cells(sonsat, 21) = annesağmı
Cells(sonsat, 22) = annemaaşı
Cells(sonsat, 23) = annebababirliktemi
Cells(sonsat, 24) = evkiramı
Cells(sonsat, 25) = stajbaşlamatarihi
Cells(sonsat, 26) = stajbitiştarihi
Cells(sonsat, 27) = stajsüresi
Cells(sonsat, 28) = stajyeriadı
Cells(sonsat, 29) = çalıştığıbirim
Cells(sonsat, 30) = adres
Cells(sonsat, 31) = mezuntarihi
Cells(sonsat, 32) = okuldurumu
Cells(sonsat, 33) = okuladı
Cells(sonsat, 34) = işdurumu
Cells(sonsat, 35) = işadresi
Cells(sonsat, 36) = emailadresi
ListBox1.RowSource = "A2:AI" & [a65536].End(3).Row
MsgBox "DEĞİŞİKLİK YAPILMIŞTIR"
End Sub

DOSYAYI EKLİYORUM BAKABİLİRSENİZ SEVİNİRİM.LİSTBOX TA HATA OLUŞUYOR
 

Ekli dosyalar

Son düzenleme:
Arkadaşlar aşağıdaki kodlarda kayıtları güncelleme yaparken aynı kayıttan iki tane oluşuyor.Yardımcı olursanız sevinirim.


Private Sub CommandButton2_Click()
sor = MsgBox("Değiştirmek istediğinizden eminmisiniz?", vbYesNo)
If sor = vbNo Then Exit Sub
CommandButton2.Caption = " DEĞİŞTİRİLDİ"
CommandButton2.Caption = " DEĞİŞTİR"
sonsat = ListBox1.ListIndex + 2
Cells(sonsat, 1) = tcno
Cells(sonsat, 2) = adı
Cells(sonsat, 3) = soyadı
Cells(sonsat, 4) = bölümü
Cells(sonsat, 5) = sınıfşube
Cells(sonsat, 6) = okulno
Cells(sonsat, 7) = doğumyeri
Cells(sonsat, 8) = doğumtarihi
Cells(sonsat, 9) = evtlfno
Cells(sonsat, 10) = cepno
Cells(sonsat, 11) = evadresi
Cells(sonsat, 12) = kardeşsayısı
Cells(sonsat, 13) = babaadı
Cells(sonsat, 14) = babamesleği
Cells(sonsat, 15) = babaceptlfno
Cells(sonsat, 16) = babasağmı
Cells(sonsat, 17) = babamaaşı
Cells(sonsat, 18) = anneadı
Cells(sonsat, 19) = annemesleği
Cells(sonsat, 20) = anneceptlfno
Cells(sonsat, 21) = annesağmı
Cells(sonsat, 22) = annemaaşı
Cells(sonsat, 23) = annebababirliktemi
Cells(sonsat, 24) = evkiramı
Cells(sonsat, 25) = stajbaşlamatarihi
Cells(sonsat, 26) = stajbitiştarihi
Cells(sonsat, 27) = stajsüresi
Cells(sonsat, 28) = stajyeriadı
Cells(sonsat, 29) = çalıştığıbirim
Cells(sonsat, 30) = adres
Cells(sonsat, 31) = mezuntarihi
Cells(sonsat, 32) = okuldurumu
Cells(sonsat, 33) = okuladı
Cells(sonsat, 34) = işdurumu
Cells(sonsat, 35) = işadresi
Cells(sonsat, 36) = emailadresi
ListBox1.RowSource = "A2:AI" & [a65536].End(3).Row
MsgBox "DEĞİŞİKLİK YAPILMIŞTIR"
End Sub

Kodlarınızda bir eksiklik gözükmüyor ben kırmızı yeri ekledim.genede olmazsa yani seçilen satırın üstüne güncelleme yapıyorsa yeşil renkli sayıyı bir değer çoğaltın veya seçilen satırın altına güncelleme yapıyorsa yeşil renkli sayıyı bir değer azaltın

Kod:
Private Sub CommandButton2_Click()
sor = MsgBox("Değiştirmek istediğinizden eminmisiniz?", vbYesNo)
If sor = vbNo Then Exit Sub
CommandButton2.Caption = " DEĞİŞTİRİLDİ"
CommandButton2.Caption = " DEĞİŞTİR"
sonsat = ListBox1.ListIndex + [SIZE=3][COLOR=lime][B]2[/B][/COLOR][/SIZE]
[COLOR=red]ListBox1.RowSource = ""[/COLOR]
Cells(sonsat, 1) = tcno
Cells(sonsat, 2) = adı
Cells(sonsat, 3) = soyadı
Cells(sonsat, 4) = bölümü
Cells(sonsat, 5) = sınıfşube
Cells(sonsat, 6) = okulno
Cells(sonsat, 7) = doğumyeri
Cells(sonsat, 8) = doğumtarihi
Cells(sonsat, 9) = evtlfno
Cells(sonsat, 10) = cepno
Cells(sonsat, 11) = evadresi
Cells(sonsat, 12) = kardeşsayısı
Cells(sonsat, 13) = babaadı
Cells(sonsat, 14) = babamesleği
Cells(sonsat, 15) = babaceptlfno
Cells(sonsat, 16) = babasağmı
Cells(sonsat, 17) = babamaaşı
Cells(sonsat, 18) = anneadı
Cells(sonsat, 19) = annemesleği
Cells(sonsat, 20) = anneceptlfno
Cells(sonsat, 21) = annesağmı
Cells(sonsat, 22) = annemaaşı
Cells(sonsat, 23) = annebababirliktemi
Cells(sonsat, 24) = evkiramı
Cells(sonsat, 25) = stajbaşlamatarihi
Cells(sonsat, 26) = stajbitiştarihi
Cells(sonsat, 27) = stajsüresi
Cells(sonsat, 28) = stajyeriadı
Cells(sonsat, 29) = çalıştığıbirim
Cells(sonsat, 30) = adres
Cells(sonsat, 31) = mezuntarihi
Cells(sonsat, 32) = okuldurumu
Cells(sonsat, 33) = okuladı
Cells(sonsat, 34) = işdurumu
Cells(sonsat, 35) = işadresi
Cells(sonsat, 36) = emailadresi
ListBox1.RowSource = "A2:AI" & [a65536].End(3).Row
MsgBox "DEĞİŞİKLİK YAPILMIŞTIR"
End Sub
 
Arkadaşlar ekli dosyada açıklamayı yaptım.

Kod:
Private Sub CommandButton5_Click()
    If ComboBox1 = "Vazgeçildi" Or ComboBox1 = "Siparişte" Then
        If ComboBox2.ListIndex < 0 Then
            MsgBox "Yüzde alanı için değer seçimi yapınız!", vbCritical
            Exit Sub
        End If
GoTo 99

    Else
    
99
        For a = 1 To 22
        '1 den 19'e kadar textbox'lar döngü kuruluyor
        If TextBox1.Value = "" Then
        TextBox1.SetFocus
        MsgBox ("Kat No Alanı Boş Bırakılamaz. Lütfen Kat Numarası Giriniz."), vbInformation, "A++"
        Exit Sub
        End If
        If TextBox2.Value = "" Then
        TextBox2.SetFocus
        MsgBox ("Raf No Alanı Boş Bırakılamaz. Lütfen Raf Numarası Giriniz."), vbInformation, "A++"
        Exit Sub
        End If
        If TextBox3.Value = "" Then
        TextBox3.SetFocus
        MsgBox ("Tarih Alanı Boş Bırakılamaz. Lütfen Tarih Giriniz."), vbInformation, "A++"
        Exit Sub
        'işlem bitiriliyor
        End If
        'if sonlandırılıyor
        Next
        
        ts = ListBox1.ListIndex + 4
        cevap = MsgBox("Satış verilerini güncellemek istediğinize emin misiniz?", vbInformation + vbYesNo, "A++")
        If cevap = vbNo Then Exit Sub
        Sheets("Btck").Select
        ListBox1.RowSource = ""
        Cells(ts, "A") = TextBox1.Value
        Cells(ts, "B") = TextBox2.Value
        Cells(ts, "C") = TextBox3.Value
        Cells(ts, "J") = TextBox4.Value
        Cells(ts, "L") = TextBox5.Value
        Cells(ts, "N") = TextBox6.Value
        Cells(ts, "T") = TextBox7.Value
        Cells(ts, "P") = TextBox8.Value
        Cells(ts, "R") = TextBox9.Value
        Cells(ts, "AF") = TextBox10.Value
        Cells(ts, "AD") = TextBox11.Value
        Cells(ts, "V") = TextBox12.Value
        Cells(ts, "AL") = TextBox13.Value
        Cells(ts, "AH") = TextBox14.Value
        Cells(ts, "AJ") = TextBox15.Value
        Cells(ts, "Z") = TextBox16.Value
        Cells(ts, "AN") = TextBox17.Value
        Cells(ts, "X") = TextBox18.Value
        Cells(ts, "AB") = TextBox19.Value
        Cells(ts, "D") = TextBox21.Value
        Cells(ts, "G") = TextBox22.Value
        Cells(ts, "F") = ComboBox1.Value
        Cells(ts, "AP") = ComboBox2.Value
        UserForm_Initialize
    
    GoTo 88

77
MsgBox "kayıt güncelleme işlemi iptal edildi.", vbInformation, "A++"
Exit Sub

End If
88

Dim z
For z = 4 To [C:C].Find("*", , , , xlByRows, xlPrevious).Row '4. satırdan itibaren  "C" hücresi için dolu satır sayısınca döngü yapıyor
Cells(z, "D").Value = Format(Cells(z, "C").Value + 3, "dd.mm.yyyy") ' c sutununa 3 günlük tarihi yazıyor

Next
For z = 4 To [C:C].Find("*", , , , xlByRows, xlPrevious).Row '4. satırdan itibaren  "C" hücresi için dolu satır sayısınca döngü yapıyor
Cells(z, "G").Value = Format(Cells(z, "C").Value + 11, "dd.mm.yyyy") ' c sutununa 3 günlük tarihi yazıyor

Next

GoTo 66

66

Dim güncelleme
Sheets("Btck").Select
güncelleme = MsgBox("kayıt başarıyla güncellendi.", vbInformation + vbOKOnly, "A++")
    If soru = vbOKOnly Then
 
    End If
End Sub

Sorun şu userform2 de takip kontrol sistemi butonuna basınca işlem yapılıp userform4 açılıyor ve orada listboxta veriler listelenip textboxlara alınıyor. güncelle butonuna tıklayınca ilgili hücreyi güncellemek istiyorum fakat her defasında farklı satırı güncelliyor. Bir türlü hatayı tespit edemedim yardımlarınızı bekliyorum. Dosya ekte mevcut.
 

Ekli dosyalar

Arkadaşlar ekli dosyada açıklamayı yaptım.

Kod:
Private Sub CommandButton5_Click()
    If ComboBox1 = "Vazgeçildi" Or ComboBox1 = "Siparişte" Then
        If ComboBox2.ListIndex < 0 Then
            MsgBox "Yüzde alanı için değer seçimi yapınız!", vbCritical
            Exit Sub
        End If
GoTo 99

    Else
    
99
        For a = 1 To 22
        '1 den 19'e kadar textbox'lar döngü kuruluyor
        If TextBox1.Value = "" Then
        TextBox1.SetFocus
        MsgBox ("Kat No Alanı Boş Bırakılamaz. Lütfen Kat Numarası Giriniz."), vbInformation, "A++"
        Exit Sub
        End If
        If TextBox2.Value = "" Then
        TextBox2.SetFocus
        MsgBox ("Raf No Alanı Boş Bırakılamaz. Lütfen Raf Numarası Giriniz."), vbInformation, "A++"
        Exit Sub
        End If
        If TextBox3.Value = "" Then
        TextBox3.SetFocus
        MsgBox ("Tarih Alanı Boş Bırakılamaz. Lütfen Tarih Giriniz."), vbInformation, "A++"
        Exit Sub
        'işlem bitiriliyor
        End If
        'if sonlandırılıyor
        Next
        
        ts = ListBox1.ListIndex + 4
        cevap = MsgBox("Satış verilerini güncellemek istediğinize emin misiniz?", vbInformation + vbYesNo, "A++")
        If cevap = vbNo Then Exit Sub
        Sheets("Btck").Select
        ListBox1.RowSource = ""
        Cells(ts, "A") = TextBox1.Value
        Cells(ts, "B") = TextBox2.Value
        Cells(ts, "C") = TextBox3.Value
        Cells(ts, "J") = TextBox4.Value
        Cells(ts, "L") = TextBox5.Value
        Cells(ts, "N") = TextBox6.Value
        Cells(ts, "T") = TextBox7.Value
        Cells(ts, "P") = TextBox8.Value
        Cells(ts, "R") = TextBox9.Value
        Cells(ts, "AF") = TextBox10.Value
        Cells(ts, "AD") = TextBox11.Value
        Cells(ts, "V") = TextBox12.Value
        Cells(ts, "AL") = TextBox13.Value
        Cells(ts, "AH") = TextBox14.Value
        Cells(ts, "AJ") = TextBox15.Value
        Cells(ts, "Z") = TextBox16.Value
        Cells(ts, "AN") = TextBox17.Value
        Cells(ts, "X") = TextBox18.Value
        Cells(ts, "AB") = TextBox19.Value
        Cells(ts, "D") = TextBox21.Value
        Cells(ts, "G") = TextBox22.Value
        Cells(ts, "F") = ComboBox1.Value
        Cells(ts, "AP") = ComboBox2.Value
        UserForm_Initialize
    
    GoTo 88

77
MsgBox "kayıt güncelleme işlemi iptal edildi.", vbInformation, "A++"
Exit Sub

End If
88

Dim z
For z = 4 To [C:C].Find("*", , , , xlByRows, xlPrevious).Row '4. satırdan itibaren  "C" hücresi için dolu satır sayısınca döngü yapıyor
Cells(z, "D").Value = Format(Cells(z, "C").Value + 3, "dd.mm.yyyy") ' c sutununa 3 günlük tarihi yazıyor

Next
For z = 4 To [C:C].Find("*", , , , xlByRows, xlPrevious).Row '4. satırdan itibaren  "C" hücresi için dolu satır sayısınca döngü yapıyor
Cells(z, "G").Value = Format(Cells(z, "C").Value + 11, "dd.mm.yyyy") ' c sutununa 3 günlük tarihi yazıyor

Next

GoTo 66

66

Dim güncelleme
Sheets("Btck").Select
güncelleme = MsgBox("kayıt başarıyla güncellendi.", vbInformation + vbOKOnly, "A++")
    If soru = vbOKOnly Then
 
    End If
End Sub

Sorun şu userform2 de takip kontrol sistemi butonuna basınca işlem yapılıp userform4 açılıyor ve orada listboxta veriler listelenip textboxlara alınıyor. güncelle butonuna tıklayınca ilgili hücreyi güncellemek istiyorum fakat her defasında farklı satırı güncelliyor. Bir türlü hatayı tespit edemedim yardımlarınızı bekliyorum. Dosya ekte mevcut.

çözümü olan var mı arkadaşlar?
 
Sorun çözüldü.

Kod:
Private Sub CommandButton5_Click()
    If ComboBox1 = "Vazgeçildi" Or ComboBox1 = "Siparişte" Then
        If ComboBox2.ListIndex < 0 Then
            MsgBox "Yüzde alanı için değer seçimi yapınız!", vbCritical
            Exit Sub
        End If
GoTo 99

    Else
    
99
        For a = 1 To 22
        '1 den 19'e kadar textbox'lar döngü kuruluyor
        If TextBox1.Value = "" Then
        TextBox1.SetFocus
        MsgBox ("Kat No Alanı Boş Bırakılamaz. Lütfen Kat Numarası Giriniz."), vbInformation, "A++"
        Exit Sub
        End If
        If TextBox2.Value = "" Then
        TextBox2.SetFocus
        MsgBox ("Raf No Alanı Boş Bırakılamaz. Lütfen Raf Numarası Giriniz."), vbInformation, "A++"
        Exit Sub
        End If
        If TextBox3.Value = "" Then
        TextBox3.SetFocus
        MsgBox ("Tarih Alanı Boş Bırakılamaz. Lütfen Tarih Giriniz."), vbInformation, "A++"
        Exit Sub
        'işlem bitiriliyor
        End If
        'if sonlandırılıyor
        Next
        
      [COLOR="Red"] ts = ActiveCell.Select + 2[/COLOR]

cevap = MsgBox("Satış verilerini güncellemek istediğinize emin misiniz?", vbInformation + vbYesNo, "A++")
        If cevap = vbNo Then Exit Sub
        Sheets("Btck").Select
        ListBox1.RowSource = ""

[COLOR="red"]ActiveCell(ts, "A") = TextBox1.Value
ActiveCell(ts, "B") = TextBox2.Value
ActiveCell(ts, "C") = CDate(TextBox3.Value)
ActiveCell(ts, "J") = TextBox4.Value
ActiveCell(ts, "L") = TextBox5.Value
ActiveCell(ts, "N") = TextBox6.Value
ActiveCell(ts, "T") = TextBox7.Value
ActiveCell(ts, "P") = TextBox8.Value
ActiveCell(ts, "R") = TextBox9.Value
ActiveCell(ts, "AF") = TextBox10.Value
ActiveCell(ts, "AD") = TextBox11.Value
ActiveCell(ts, "V") = TextBox12.Value
ActiveCell(ts, "AL") = TextBox13.Value
ActiveCell(ts, "AH") = TextBox14.Value
ActiveCell(ts, "AJ") = TextBox15.Value
ActiveCell(ts, "Z") = TextBox16.Value
ActiveCell(ts, "AN") = TextBox17.Value
ActiveCell(ts, "X") = TextBox18.Value
ActiveCell(ts, "AB") = TextBox19.Value
ActiveCell(ts, "D") = CDate(TextBox21.Value)
ActiveCell(ts, "G") = CDate(TextBox22.Value)
ActiveCell(ts, "F") = ComboBox1.Value
ActiveCell(ts, "AP") = ComboBox2.Value[/COLOR]
UserForm_Initialize

    GoTo 88

77
MsgBox "kayıt güncelleme işlemi iptal edildi.", vbInformation, "A++"
Exit Sub

End If
88

Dim z
For z = 4 To [C:C].Find("*", , , , xlByRows, xlPrevious).Row '4. satırdan itibaren  "C" hücresi için dolu satır sayısınca döngü yapıyor
Cells(z, "D").Value = Format(Cells(z, "C").Value + 3, "dd.mm.yyyy") ' c sutununa 3 günlük tarihi yazıyor

Next
For z = 4 To [C:C].Find("*", , , , xlByRows, xlPrevious).Row '4. satırdan itibaren  "C" hücresi için dolu satır sayısınca döngü yapıyor
Cells(z, "G").Value = Format(Cells(z, "C").Value + 11, "dd.mm.yyyy") ' c sutununa 3 günlük tarihi yazıyor

Next

GoTo 66

66

Dim güncelleme
Sheets("Btck").Select
güncelleme = MsgBox("kayıt başarıyla güncellendi.", vbInformation + vbOKOnly, "A++")
    If soru = vbOKOnly Then
 
    End If
End Sub


arkadaşlar hayırlı kandiller. Sorunu çözdüm. Herkes faydalansın diye paylaşıyorum. Kolay gelsin herkese.
 
Geri
Üst