Aşağıdaki kodlarla listboxta verileri süzüyorum. Ancak Optionbutton3 ile seçtiğim "S" sütununda tarihe göre süzmek istediğim zaman tarihe göre süzme yapmıyor. Daha önce "S" sütununa tarihi metin olarak giriyordum. O zaman süzme işleminde sıkıntı yoktu. Ancak "S" sütununa Tarihleri sayısal olarak olarak giriş yapınca süzme işleminde sıkıntı doğdu. Problemin çözümü için aşağıdaki kodlarda nasıl bir değişiklik yapılacağı hususunda yardımlarınızı bekliyorum. İyi çalışmalar.
Private Sub TextBox30_Change()
If OptionButton1.Value = True Then sut = "C"
If OptionButton2.Value = True Then sut = "D"
If OptionButton3.Value = True Then sut = "S"
Dim k As Range, adrs As String, j As Byte, a, sat As Long
ReDim myarr(0 To 18, 1 To 1)
If TextBox25.Text = "" Then
sat = ActiveSheet.Cells(65536, "A").End(xlUp).Row
ListBox1.RowSource = ComboBox1.Text & "!A3:S" & sat
Exit Sub
End If
Set sy1 = Sheets("" & ComboBox1)
With sy1
ListBox1.RowSource = ""
If .FilterMode Then .ShowAllData
Set k = .Range(sut & "3:" & sut & "65536").Find(TextBox25.Text & "*", , xlValues, xlWhole)
If Not k Is Nothing Then
adrs = k.Address
Do
a = a + 1
ReDim Preserve myarr(0 To 18, 1 To a)
For j = 0 To 17
myarr(j, a) = .Cells(k.Row, j + 1).Value
Next j
For Z = 18 To 18
myarr(Z, a) = Format(.Cells(k.Row, Z + 1).Value, "dd.mm.yyyy")
Next Z
Set k = sy1.Range(sut & "3:" & sut & "65536").FindNext(k)
Loop While Not k Is Nothing And k.Address <> adrs
ListBox1.Column = myarr
End If
End With
End Sub
Private Sub TextBox30_Change()
If OptionButton1.Value = True Then sut = "C"
If OptionButton2.Value = True Then sut = "D"
If OptionButton3.Value = True Then sut = "S"
Dim k As Range, adrs As String, j As Byte, a, sat As Long
ReDim myarr(0 To 18, 1 To 1)
If TextBox25.Text = "" Then
sat = ActiveSheet.Cells(65536, "A").End(xlUp).Row
ListBox1.RowSource = ComboBox1.Text & "!A3:S" & sat
Exit Sub
End If
Set sy1 = Sheets("" & ComboBox1)
With sy1
ListBox1.RowSource = ""
If .FilterMode Then .ShowAllData
Set k = .Range(sut & "3:" & sut & "65536").Find(TextBox25.Text & "*", , xlValues, xlWhole)
If Not k Is Nothing Then
adrs = k.Address
Do
a = a + 1
ReDim Preserve myarr(0 To 18, 1 To a)
For j = 0 To 17
myarr(j, a) = .Cells(k.Row, j + 1).Value
Next j
For Z = 18 To 18
myarr(Z, a) = Format(.Cells(k.Row, Z + 1).Value, "dd.mm.yyyy")
Next Z
Set k = sy1.Range(sut & "3:" & sut & "65536").FindNext(k)
Loop While Not k Is Nothing And k.Address <> adrs
ListBox1.Column = myarr
End If
End With
End Sub
Ekli dosyalar
-
30.5 KB Görüntüleme: 26
Son düzenleme: