"ListBox" ya da "Textbox arama" kodlarımda tarih hatası

Katılım
19 Haziran 2007
Mesajlar
418
Excel Vers. ve Dili
excel 2007
Merhaba arkadaşlar.
Aşağıdaki kodlarımla listbox üzerinde arama yapıyorum. Normalde 23.05.2012 formatında kaydedilen ve listboxta böyle görülen format. Arama yaparak veriler süzüldükten sonra 5/23/2012 şeklinde görüntüleniyor. Buraya kadar bir problem yok. Ama süzülen veri üzerinde düzeltme işlemi yaptıktan sonra problem oluşuyor. Excel hücresinde sağ yaslı olarak duran bu tarih sola doğru yaslanıyor. Bu seferde otomatik filtreleme kodlarım bu tarihi görmüyor.... Umarım sorunuma bir çözüm bulabiliriz?

veri arama kodlarım:
Kod:
Private Sub TextBox13_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
    Dim BUL As Range, ADRES As String, Sutun As Byte, Satir As Long
    
    
    If KeyCode = 13 Then
        If TextBox13.Text = "" Then
            ListBox1.RowSource = "Satış!A2:V" & Sheets("Satış").Cells(Rows.Count, "A").End(xlUp).Row
            Exit Sub
        End If
    
    On Error Resume Next
    ListBox1.RowSource = ""
    ListBox1.Clear
    On Error GoTo 0
    
    
    
    
        Application.ScreenUpdating = False
        
     
        ReDim Veri_Dizisi(1 To 22, 1 To 65536)
        
                
        With Worksheets("Satış")
            If .FilterMode Then .ShowAllData
            Set BUL = .Range("C:C").Find(TextBox13.Text, , xlValues, xlPart)
            If Not BUL Is Nothing Then
                ADRES = BUL.Address
                Do
                    Satir = Satir + 1
                    Veri_Dizisi(22, Satir) = BUL.Row
                    For Sutun = 1 To 21
                        Veri_Dizisi(Sutun, Satir) = .Cells(BUL.Row, Sutun).Value
                    Next
                    
                    Set BUL = Range("C:C").FindNext(BUL)
                Loop While Not BUL Is Nothing And BUL.Address <> ADRES
                
                ReDim Preserve Veri_Dizisi(1 To 22, 1 To Satir)
                
                ListBox1.Column = Veri_Dizisi
            End If
        End With
        Application.ScreenUpdating = True
    End If
    
    TextBox18.Text = ListBox1.ListCount
    
    
        For e = 0 To ListBox1.ListCount - 1
    t1 = CDbl(Val(ListBox1.List(e, 8))) + CDbl(Val(t1))
    Next e
    TextBox19.Text = FormatNumber(t1, 2) & " TL"
    
    
End Sub
Düzelt kodlarım:
Kod:
Private Sub CommandButton3_Click()
If ListBox1.ListCount > 0 Then
Lab = ListBox1.ListIndex + 1
Else
MsgBox "listede hiç veri yok"
Exit Sub
End If

If Lab <= 0 Then
MsgBox "listeden veri seçiniz"
Exit Sub
End If
'Değiştir butonuna basıldığında yapılacak işlemler.
sor = MsgBox("Değiştirmek istediğinizden emin misiniz?", vbYesNo)
'mesaj kutusu devreye giriyor.
If sor = vbNo Then Exit Sub
'evet veya hayır cevaplarından Hayır ise kodlar sonlandırılıyor.
If ListBox1.Column(21) = 0 Or ListBox1.Column(21) = "" Then
sonsat = ListBox1.ListIndex + 2
Else
sonsat = ListBox1.Column(21)
End If

'son satır numarası alınıyor.
Cells(sonsat, 1) = TextBox1.Value
'ikinci sutununun en son satırına textbox2 deki açıklama yazılıyor.

Cells(sonsat, 2) = TextBox2.Value
Cells(sonsat, 3) = TextBox3.Value
Cells(sonsat, 4) = TextBox4.Value
Cells(sonsat, 5) = ComboBox1.Value
Cells(sonsat, 6) = ComboBox2.Value
Cells(sonsat, 7) = TextBox5.Value
Cells(sonsat, 8) = TextBox6.Value
Cells(sonsat, 9) = TextBox7.Value
Cells(sonsat, 10) = ComboBox3.Value
Cells(sonsat, 11) = ComboBox4.Value
Cells(sonsat, 12) = TextBox8.Value
Cells(sonsat, 13) = ComboBox5.Value
Cells(sonsat, 14) = ComboBox6.Value
Cells(sonsat, 15) = ComboBox7.Value
Cells(sonsat, 16) = ComboBox8.Value
Cells(sonsat, 17) = ComboBox9.Value
Cells(sonsat, 18) = ComboBox10.Value
Cells(sonsat, 19) = ComboBox11.Value
Cells(sonsat, 20) = TextBox9.Value
Cells(sonsat, 21) = TextBox10.Value
Cells(sonsat, 22) = CLng(CDate(TextBox12))
ListBox1.RowSource = "A2:V" & [a65536].End(3).Row
'liste kutusunun satır kaynagının hangi hücreler olduğu belirtiliyor.
MsgBox "DEĞİŞİKLİK YAPILMIŞTIR"


For i = 2 To 10
Controls("Textbox" & i).Value = ""
Next
ListBox1.RowSource = "A1:U" & [a65536].End(3).Row


    Call UserForm_Initialize
End Sub
 
Üst