userformda kayıt düzeltme

Katılım
21 Nisan 2005
Mesajlar
122
ataç ekle butanu olmadıği için dosya gönderemiyorum. benim sorunum; userformada yeni kayıt yapabiliyorum. fakat userformda excel sayfasında bulunanan kayıtlar arasında scrollbar ile gezinti yapabiliyorum ama bu kayıtlar üzerinde düzeltme yapılmasına rağmen düzeltilmiş kayıtlar userformdan çıkılıp tekrar girildiğinde kayboluyor eski haline geliyor. ben user form üzerinde bir commandbutton ilave edip, kayıtların bulunduğu satıra güncellenmiş haliyle kaydetmek istiyorum. bir türlü beceremedim. Ayrıca userformu kapatan x işaretini kaldırmak istiyorum. yardımcı olun
 
Katılım
3 Mart 2005
Mesajlar
571
Excel Vers. ve Dili
Excel 2000 Ing.
merhaba,
forumuzda bu konu ile ilgili birçok örnek var,
dosya olmadığı için size forumdan arama yapmanızı tevsiye edeceğim.
ancak, yine de fikir vermesi açısından güncelleme hakkında bilgi vermek isterim.

genel olarak eğer exceldeki veriler textboxlara atayabiliyorsanız,
aynı yontemle bu textlerdeki verileri hücrelere atamalısınız,

anladığım kadarıyle formunuz modal modda değil ve excel sayfaına ulaşabiliyorsunuz.
bir hücrer seçilince aktif kayıtlar tetxboxlarda görülüyor olarak algılıyorum.
bu durumda kod şöyle olmalı
mantık olarak.

sirano:Activecell.Row
cells(sirano,2)=textbox2.text
cells(sirano,3)=textbox3.text
cells(sirano,4)=textbox4.text
cells(sirano,5)=textbox5.text
..
bu şekilde hücrelere atanacaktır.

aksi taktirde, benzersiz kayıt (örneğin sıra no) find ile aratılıp bulunan
hücrenin satırındaki veriler yine aynı mantıkla güncellenecektir.
 
Katılım
21 Nisan 2005
Mesajlar
122
sayın isa karakuş,
formda kaydet butonu var. kodu aşağıdaki gibidir,
Private Sub TextBox1_Change()
Private Sub kaydet_click()
Dim cel As Range, lastRow As Long, myRow As Long, _
desc As String, button, header
lastRow = Range("A3000").End(xlUp).Row
myRow = lastRow + 1
If Range("A1").Value = "" Then
Range("A1").Value = 1
Else
Cells(myRow, 1).Value = lastRow
End If
Cells(myRow, 1).Value = txt1.Text
Cells(myRow, 2).Value = txt2.Text
Cells(myRow, 3).Value = txt3.Text
Cells(myRow, 4).Value = txt4.Text
Cells(myRow, 5).Value = txt5.Text
Cells(myRow, 6).Value = txt6.Text
Cells(myRow, 7).Value = txt7.Text
Cells(myRow, 8).Value = txt8.Text
Cells(myRow, 9).Value = txt9.Text
Cells(myRow, 10).Value = txt10.Text
Cells(myRow, 11).Value = txt11.Text
Cells(myRow, 12).Value = txt12.Text
Cells(myRow, 13).Value = txt13.Text
Cells(myRow, 14).Value = txt14.Text
Cells(myRow, 15).Value = txt15.Text
Cells(myRow, 16).Value = txt16.Text
Cells(myRow, 17).Value = txt17.Text
Cells(myRow, 18).Value = txt18.Text
Cells(myRow, 19).Value = txt19.Text
Cells(myRow, 20).Value = txt20.Text
Cells(myRow, 21).Value = txt21.Text
Cells(myRow, 22).Value = txt22.Text
Cells(myRow, 23).Value = txt23.Text
Cells(myRow, 24).Value = txt24.Text
Cells(myRow, 25).Value = txt25.Text
Cells(myRow, 26).Value = txt26.Text
Cells(myRow, 27).Value = txt27.Text
Cells(myRow, 28).Value = txt28.Text
Cells(myRow, 29).Value = txt29.Text
Cells(myRow, 30).Value = txt30.Text
Cells(myRow, 31).Value = txt31.Text
Cells(myRow, 32).Value = txt32.Text
Cells(myRow, 33).Value = txt33.Text
Cells(myRow, 34).Value = txt34.Text
Cells(myRow, 35).Value = txt35.Text
Cells(myRow, 36).Value = txt36.Text
Cells(myRow, 37).Value = txt37.Text
Cells(myRow, 38).Value = txt38.Text
Cells(myRow, 39).Value = txt39.Text
Cells(myRow, 40).Value = txt40.Text
desc = "Kayıt başarıyla yapıldı"
button = vbOKOnly + vbInformation + vbDefaultButton1
header = "Kayit"
MsgBox desc, button, header
Call CLR
End Sub
Private Sub CLR()
txt1.Value = ""
txt2.Value = ""
txt3.Value = ""
txt4.Value = ""
txt5.Value = ""
txt6.Value = ""
txt7.Value = ""
txt8.Value = ""
txt9.Value = ""
txt10.Value = ""
txt11.Value = ""
txt12.Value = ""
txt13.Value = ""
txt14.Value = ""
txt15.Value = ""
txt16.Value = ""
txt17.Value = ""
txt18.Value = ""
txt19.Value = ""
txt20.Value = ""
txt21.Value = ""
txt22.Value = ""
txt23.Value = ""
txt24.Value = ""
txt25.Value = ""
txt26.Value = ""
txt27.Value = ""
txt28.Value = ""
txt29.Value = ""
txt30.Value = ""
txt31.Value = ""
txt32.Value = ""
txt33.Value = ""
txt34.Value = ""
txt35.Value = ""
txt36.Value = ""
txt37.Value = ""
txt38.Value = ""
txt39.Value = ""
txt40.Value = ""
End Sub

ben bilgileri güncelleştirdikten sonra yeniden eski kayıtın üzerine kayıt yapmasını istiyorum
 
Üst