Sevgili Hocalarım ;
1 adet userform üzerinde 1 adet listview, 2 adet textbox, 1 adet combobox ve 1 adet commandbuton bulunmaktadır.
Yapmak istediğim şu;
Combobox'da seçtiğim hücredeki değerleri tarihler baz alınarak , textbox1 ve textbox2 ye gireceğim tarihler arasında commandbuton1 kullanarak sayfadaki verileri süzdürerek listviewe aktarmak istiyorum bunu nasıl yapa bilirim...
elimde bir kod var ama hata veriyor ...
Private Sub CommandButton1_Click()
On Error Resume Next
Dim baslangic_tar As Date, bitis_tar As Date, plaka As String
Dim I As Long, x As Long, k As Byte, A As Long
If Not IsDate(TextBox3.Value) Then
MsgBox "Başlangıç tarihi yanlış veya seçilmedi..", vbCritical, "UYARI"
TextBox3.SetFocus
Exit Sub
End If
If Not IsDate(TextBox4.Value) Then
MsgBox "Son tarih yanlış veya seçilmedi..!!", vbCritical, "UYARI"
TextBox4.SetFocus
Exit Sub
End If
ListView1.RowSource = vbNullString
baslangic_tar = CDate(TextBox3.Text)
bitis_tar = CDate(TextBox4.Text)
ReDim myarr(1 To 11, 1 To 1)
For I = 2 To Cells(65536, "B").End(xlUp).Row
If ComboBox3.Value = "" Then
plaka = Cells(I, "C").Value
Else
plaka = ComboBox3.Value
End If
If Cells(I, 2).Value >= baslangic_tar And Cells(I, 2).Value <= bitis_tar And plaka = Cells(I, 3).Value Then
A = A + 1
ReDim Preserve myarr(1 To 11, 1 To A)
For k = 1 To 11
myarr(k, A) = Cells(I, k)
Next k
Else
End If
Next I
If A > 0 Then ListView1.Column = myarr 'hata veren satır
Erase myarr
With AKTAR.ListView1
.ListItems.Clear
.BackColor = vbYellow
.ForeColor = vbRed
.Gridlines = True
.View = lvwReport
.FullRowSelect = True
End With
End Sub
1 adet userform üzerinde 1 adet listview, 2 adet textbox, 1 adet combobox ve 1 adet commandbuton bulunmaktadır.
Yapmak istediğim şu;
Combobox'da seçtiğim hücredeki değerleri tarihler baz alınarak , textbox1 ve textbox2 ye gireceğim tarihler arasında commandbuton1 kullanarak sayfadaki verileri süzdürerek listviewe aktarmak istiyorum bunu nasıl yapa bilirim...
elimde bir kod var ama hata veriyor ...
Private Sub CommandButton1_Click()
On Error Resume Next
Dim baslangic_tar As Date, bitis_tar As Date, plaka As String
Dim I As Long, x As Long, k As Byte, A As Long
If Not IsDate(TextBox3.Value) Then
MsgBox "Başlangıç tarihi yanlış veya seçilmedi..", vbCritical, "UYARI"
TextBox3.SetFocus
Exit Sub
End If
If Not IsDate(TextBox4.Value) Then
MsgBox "Son tarih yanlış veya seçilmedi..!!", vbCritical, "UYARI"
TextBox4.SetFocus
Exit Sub
End If
ListView1.RowSource = vbNullString
baslangic_tar = CDate(TextBox3.Text)
bitis_tar = CDate(TextBox4.Text)
ReDim myarr(1 To 11, 1 To 1)
For I = 2 To Cells(65536, "B").End(xlUp).Row
If ComboBox3.Value = "" Then
plaka = Cells(I, "C").Value
Else
plaka = ComboBox3.Value
End If
If Cells(I, 2).Value >= baslangic_tar And Cells(I, 2).Value <= bitis_tar And plaka = Cells(I, 3).Value Then
A = A + 1
ReDim Preserve myarr(1 To 11, 1 To A)
For k = 1 To 11
myarr(k, A) = Cells(I, k)
Next k
Else
End If
Next I
If A > 0 Then ListView1.Column = myarr 'hata veren satır
Erase myarr
With AKTAR.ListView1
.ListItems.Clear
.BackColor = vbYellow
.ForeColor = vbRed
.Gridlines = True
.View = lvwReport
.FullRowSelect = True
End With
End Sub
