• DİKKAT

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

Listbox'taki seçilen verileri texboxt'tan günceleme

Katılım
18 Temmuz 2012
Mesajlar
15
Excel Vers. ve Dili
C# VB
Kod:
Private Sub ComboBox1_Change()
TextBox1.SetFocus

lblTitle.Caption = " KFZ Miete " & ComboBox1.Value
Kayitlistele
End Sub

Sub Kayitlistele()
Dim ds As Long

If ComboBox1.Value = Empty Then Exit Sub

ds = Sheets(ComboBox1.Value).Range("B200000").End(xlUp).Row
lstkayitlar.ColumnCount = 8
lstkayitlar.ColumnWidths = "15;100;80;80;80;80;80;80"
lstkayitlar.ColumnHeads = True
x = 0
For i = 1 To Worksheets.Count
    x = x + 1
    If InStr(Worksheets(i).Name, ComboBox1.Value) > 0 Then
        Exit For
    End If
Next i
shname = Worksheets(x).Name
lstkayitlar.RowSource = "'" & shname & "'!" & "A3:H" & ds + 1

End Sub

Private Sub CommandButton1_Click()
    Dim sor As Byte
    Dim ds As Long
    
    If ComboBox1.ListIndex < 0 Or TextBox1.Value = "" Or TextBox2.Value = "" Or TextBox3.Value = "" Or TextBox4.Value = "" Then
        frmMesaj.lblMesaj.Caption = "Bilgiler Eksik. Lütfen Kontrol Ediniz!!"
        frmMesaj.Show
        Exit Sub
End If
    ds = Sheets(ComboBox1.Value).Range("B200000").End(xlUp).Row
    
    sor = MsgBox("Talep kaydedilsinmi?", 68, "KAYDET")
    If sor = 7 Then Exit Sub
        Sheets(ComboBox1.Value).Range("B" & ds + 1).Value = TextBox1.Value
        Sheets(ComboBox1.Value).Range("C" & ds + 1).Value = TextBox2.Value
        Sheets(ComboBox1.Value).Range("D" & ds + 1).Value = TextBox3.Value
        Sheets(ComboBox1.Value).Range("E" & ds + 1).Value = TextBox4.Value
        Sheets(ComboBox1.Value).Range("F" & ds + 1).Value = TextBox5.Value
        Sheets(ComboBox1.Value).Range("G" & ds + 1).Value = TextBox6.Value
        Sheets(ComboBox1.Value).Range("H" & ds + 1).Value = TextBox7.Value
CommandButton2_Click
    
    
End Sub

Private Sub CommandButton2_Click()
   ComboBox1.ListIndex = -1
    TextBox1.Value = ""
    TextBox2.Value = ""
    TextBox3.Value = ""
    TextBox4.Value = Date
    TextBox5.Value = ""
    TextBox6.Value = Euro
    TextBox7.Value = ""
     ComboBox1.SetFocus
End Sub

Private Sub CommandButton3_Click()
Unload Me
End Sub

Private Sub UserForm_Initialize()
sayfaktar
End Sub

Private Sub sayfaktar()
Dim x As Integer

For x = 2 To Sheets.Count
    ComboBox1.AddItem (Sheets(x).Name)
Next
TextBox4.Value = Date


End Sub

Merhabalar,

Arkadaşlar kaydettiğim veriler aşağıda listboxt'ta listeleniyor ama ben bu listelenen verileri seçtiğimde textboxt'lara gelmesini güncele butonuna basarsam güncellemesini yapmasını istiyorum. bu konuda hangi kodları kullanabilirim teşekkürler.
 

Ekli dosyalar

Linklerde güzel örnekler var. İnceleyiniz.


 
Linklerde güzel örnekler var. İnceleyiniz.


Teşekkürler buradaki konulardan çözdüm sorunlarımı
 
Güncelle ve Silme Komutlarını uyarlayamadım bu konuda yardımcı olabilir misiniz.


Kod:
Private Sub CommandButton4_Click()

"GÜNCELEME KOMUTLARI"



End Sub

Private Sub CommandButton5_Click()


"SİLME KOMUTLARI"




End Sub


Private Sub ComboBox1_Change()
TextBox1.SetFocus

lblTitle.Caption = " KFZ Miete " & ComboBox1.Value
Kayitlistele
End Sub

Sub Kayitlistele()

Dim ds As Long
If ComboBox1.Value = Empty Then Exit Sub

ds = Sheets(ComboBox1.Value).Range("A200000").End(xlUp).Row
lstkayitlar.ColumnCount = 7
lstkayitlar.ColumnWidths = "100;80;80;80;80;80;80"
lstkayitlar.ColumnHeads = True
X = 0
For i = 1 To Worksheets.Count
    X = X + 1
    If InStr(Worksheets(i).Name, ComboBox1.Value) > 0 Then
        Exit For
    End If
Next i
shname = Worksheets(X).Name
lstkayitlar.RowSource = "'" & shname & "'!" & "A3:G" & ds + 1

End Sub

Private Sub CommandButton1_Click()
    Dim sor As Byte
    Dim ds As Long
    
    If ComboBox1.ListIndex < 0 Or TextBox1.Value = "" Or TextBox2.Value = "" Or TextBox3.Value = "" Or TextBox4.Value = "" Then
        frmMesaj.lblMesaj.Caption = "Bilgiler Eksik. Lütfen Kontrol Ediniz!!"
        frmMesaj.Show
        Exit Sub
End If
    ds = Sheets(ComboBox1.Value).Range("A200000").End(xlUp).Row
    
    sor = MsgBox("Talep kaydedilsinmi?", 68, "KAYDET")
    If sor = 7 Then Exit Sub
        Sheets(ComboBox1.Value).Range("A" & ds + 1).Value = TextBox1.Value
        Sheets(ComboBox1.Value).Range("B" & ds + 1).Value = TextBox2.Value
        Sheets(ComboBox1.Value).Range("C" & ds + 1).Value = TextBox3.Value
        Sheets(ComboBox1.Value).Range("D" & ds + 1).Value = TextBox4.Value
        Sheets(ComboBox1.Value).Range("E" & ds + 1).Value = TextBox5.Value
        Sheets(ComboBox1.Value).Range("F" & ds + 1).Value = TextBox6.Value
        Sheets(ComboBox1.Value).Range("G" & ds + 1).Value = TextBox7.Value
CommandButton2_Click
    
    
End Sub

Private Sub CommandButton2_Click()
   ComboBox1.ListIndex = -1
    TextBox1.Value = ""
    TextBox2.Value = ""
    TextBox3.Value = ""
    TextBox4.Value = ""
    TextBox5.Value = ""
    TextBox6.Value = Euro
    TextBox7.Value = ""
     ComboBox1.SetFocus
End Sub

Private Sub CommandButton3_Click()
Unload Me
End Sub

Private Sub ListBox1_Click()
Dim i As Integer
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
Sheets("Sayfa1").Select
Sheets("Sayfa1").Range("A" & ListBox1.ListIndex + 2).Select
End If
Next
End Sub

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Selection.EntireRow.Delete
End Sub
End Sub


Private Sub lstkayitlar_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
For a = 0 To 6

Controls("TextBox" & a + 1) = lstkayitlar.Column(a)
Next
sat = lstkayitlar.ListIndex + 2

End Sub

Private Sub UserForm_Initialize()
sayfaktar
End Sub

Private Sub sayfaktar()
Dim X As Integer

For X = 2 To Sheets.Count
    ComboBox1.AddItem (Sheets(X).Name)
Next

End Sub
 
Private Sub CommandButton5_Click()
Dim sf As Worksheet
Dim sfname As String
If ComboBox1 = "" Then MsgBox "Sayfa ismi bulunamadı": Exit Sub
sfname = ComboBox1
Set sf = Sheets(sfname)
secili = lstkayitlar.ListIndex + 3

If lstkayitlar.ListIndex = -1 Then MsgBox "Listede seçili veri yok": Exit Sub
sf.Rows(secili).EntireRow.Delete

Kayitlistele

End Sub


Silme için bu kodları kullandım fakat güncellemek için herhangi bir kod uyarlayamadım yardımcı olabilecek varmı ??
 
Geri
Üst