• DİKKAT

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

Değiştir Butonun Yanlış Çalışması

süzme yapıp sonra değiştirme yapınca ilk sıradaki veri değişiyordu.Sorununuz o idi.
Şimdi ise başka bir şey söylüyorsunuz.
O değiştirme konusu düzeldimi?
 
yok hocam o düzelmedi, yapamayacağım için o şekilde kullanmaya karar verdim. yani süzme yapmadığım zaman sorun olmuyor, değiştirebiliyorum, şimdi sorunum bu.
 
yok hocam o düzelmedi, yapamayacağım için o şekilde kullanmaya karar verdim. yani süzme yapmadığım zaman sorun olmuyor, değiştirebiliyorum, şimdi sorunum bu.

Onu yapacağız.
Bana initialize olayındaki listviewe kolon başlıkları aldığınız döngüyü buraya yapıştırımısınız.:cool:
 
Hocam çalışmamda 9 adet userform var hepside benze kodlamalar, en kısa olanını ekledim, saygılar.

Kod:
'******* 1. LISTVIEW' U DÜZENLİYORUZ ******

Set sh = Sheets("ParafudrTestleri")

Sheets("ParafudrTestleri").Columns.AutoFit ' EXCEL SAYFASINDAKİ SÜTUN GENİŞLİĞİNİ OTOMATİK AYARLAR

' ETİKETLERİ OTOMATİK OLARAK ALIYORUZ, BURADAKİ Sh.Range("A8")) İFADESİ SÜTUNUN BAŞLIĞIDIR


Label0 = sh.Range("A8")
Label1 = sh.Range("B8")
Label2 = sh.Range("C8")
Label3 = sh.Range("D8")
Label4 = sh.Range("E8")
Label5 = sh.Range("F8")
Label6 = sh.Range("G8")
Label7 = sh.Range("H8")
Label8 = sh.Range("I8")
Label9 = sh.Range("J8")

Label10 = sh.Range("K8")
Label11 = sh.Range("L8")
Label12 = sh.Range("M8")
Label13 = sh.Range("N8")
Label14 = sh.Range("O8")
Label15 = sh.Range("P8")

Label16 = sh.Range("Q8")
Label17 = sh.Range("R8")
Label18 = sh.Range("S8")
Label19 = sh.Range("T8")
Label20 = sh.Range("U8")
Label21 = sh.Range("V8")

Label22 = sh.Range("CN8")
Label23 = sh.Range("CO8")

Label24 = sh.Range("CT8")
Label25 = sh.Range("CU8")

son = sh.Cells(65536, 1).End(xlUp).Row
yeni = True
With UserForm9.ListView1
  .ListItems.Clear
  .Gridlines = True
  .View = lvwReport
  .FullRowSelect = True
  With .ColumnHeaders
' LISTVIEW DE SÜTUN FAZLAYSA İLAVE EDİN
' SAYFADAN BİLGİLERİ, BAŞLIKLARI ALIR " Range("A8").Width " Excel tablosundan Sütun genişliğini alır
    

For i = 1 To 99
    .Add , , sh.Cells(8, i), sh.Cells(8, i).Width
Next i
.Add , , "Satir", 0
   End With
    'ListView1.ColumnHeaders(71).Width = 0
End With

'TRAFO MERKEZİ TRAFO ADI SÜZME İŞLEMİ YAPILIYOR
ComboBox7.RowSource = "Veriler!C2:C" & Sheets("Veriler").Range _
("C" & Rows.Count).End(xlUp).Row
Call liste


ComboBox1.RowSource = "Veriler!C2:C" & Sheets("Veriler").Range _
("C" & Rows.Count).End(xlUp).Row
Call liste
 
Aşağıdaki kodları eskilerinin yerine yapıştırınız.Eskisini siliniz.
Kod:
Private Sub liste()
Dim sat As Long, i As Long, k As Integer, sh As Worksheet
Dim j As Integer
Dim tmerkezi As String, testtrafo As String
Dim testyil As Integer, tarih As Date
'Güç Trafoları testleri başlangıcı
ListView1.ListItems.Clear
' SAYFADAKİ VERİLERİ LISTVIEW İÇİNE ALIR
ListView1.ListItems.Clear
Set sh = Sheets("GüçTrafolarıTestleri")
sat = sh.Cells(Rows.Count, "A").End(xlUp).Row
j = 1
For i = 9 To sat
    If ComboBox1.Value = "" Then
        tmerkezi = UCase(Replace(Replace(sh.Cells(i, "C").Value, "i", "İ"), "ı", "I"))
    Else
        tmerkezi = UCase(Replace(Replace(ComboBox1.Value, "i", "İ"), "ı", "I"))
    End If
    If ComboBox3.Value = "" Then
        testtrafo = UCase(Replace(Replace(sh.Cells(i, "F").Value, "i", "İ"), "ı", "I"))
    Else
        testtrafo = ComboBox3.Value
    End If
    If ComboBox2.Value = "" Then
        testyil = sh.Cells(i, "D").Value
    Else
        testyil = ComboBox2.Value
    End If
        
    If tmerkezi = UCase(Replace(Replace(sh.Cells(i, "C").Value, "i", "İ"), "ı", "I")) And _
        testtrafo = sh.Cells(i, "F").Value And testyil = CInt(sh.Cells(i, "D").Value) Then
        ListView1.ListItems.Add , , sh.Cells(i, "A").Value
       [B][COLOR="Red"] For k = 1 To 98[/COLOR][/B]
            ListView1.ListItems(j).SubItems(k) = sh.Cells(i, k + 1).Value
        Next k
       [B][COLOR="red"] ListView1.ListItems(j).SubItems(99) = [/COLOR][/B]i
        j = j + 1
    End If
Next i
ListView1.SelectedItem = Nothing
End Sub

Kod:
Private Sub CommandButton2_Click()
Dim Satir As Long, sh As Worksheet
' SAYFADA VERİYİ BULUP, KAYDI DEĞİŞTİRİR(Trafo % pf testleri)
If ListView1.SelectedItem Is Nothing Then
    MsgBox "Lütfen listeden bir seçim yapınız!", vbCritical, "UYARI"
    Exit Sub
End If
If MsgBox("Seçili satırı değiştirmek istiyormusunuz?", vbYesNo, "DEĞİŞTİR") = vbNo Then
    ListView1.SelectedItem = Nothing
    Exit Sub
End If
Set sh = Sheets("GüçTrafolarıTestleri")
[B][COLOR="red"]Satir = ListView1.SelectedItem.SubItems(99)[/COLOR][/B]
'Satir = ListView1.SelectedItem.Index + 8 ' 13 RAKAMINI SÜTUN SAYINIZA GÖRE AYARLAYIN
sh.Cells(Satir, 2) = TextBox2.Text
sh.Cells(Satir, 3) = ComboBox1.Text
sh.Cells(Satir, 4) = ComboBox2.Text
sh.Cells(Satir, 5) = TextBox3.Text
sh.Cells(Satir, 6) = ComboBox3.Text

For i = 7 To 16
    sh.Cells(Satir, i) = Controls("TextBox" & i - 3)
Next i
sh.Cells(Satir, 17) = ComboBox4.Text
For i = 18 To 70
    sh.Cells(Satir, i).Value = Controls("TextBox" & i - 4)
Next i
sh.Cells(Satir, 71) = ComboBox5.Text
sh.Cells(Satir, 72) = TextBox67.Text

For i = 73 To 132
    sh.Cells(Satir, i) = Controls("TextBox" & i - 5)
Next i

sh.Cells(Satir, 133) = ComboBox6.Text
sh.Cells(Satir, 134) = TextBox128.Text

For i = 135 To 224
    sh.Cells(Satir, i) = Controls("TextBox" & i - 6)
Next i

sh.Cells(Satir, 225) = ComboBox7.Text
sh.Cells(Satir, 226) = TextBox219.Text

For i = 227 To 241
    sh.Cells(Satir, i) = Controls("TextBox" & i - 7)
Next i
sh.Cells(Satir, 242) = ComboBox8.Text
sh.Cells(Satir, 243) = TextBox235.Text

For i = 244 To 377
    sh.Cells(Satir, i) = Controls("TextBox" & i - 8)
Next i
sh.Cells(Satir, 378) = ComboBox9.Text
sh.Cells(Satir, 379) = TextBox370.Text

For i = 380 To 512
    sh.Cells(Satir, i) = Controls("TextBox" & i - 9)
Next i
sh.Cells(Satir, 513) = ComboBox10.Text
sh.Cells(Satir, 514) = TextBox504.Text

Call liste
End Sub
 
hocam silmeyide 'sat = ListView1.SelectedItem.Index + 8 kodunu
sat = ListView1.SelectedItem.SubItems(99) şeklinde hallettim sayenizde.
 
Geri
Üst