İki tarih arasını VBA ile listelemek

Katılım
31 Ocak 2023
Mesajlar
1
Excel Vers. ve Dili
makro vba
Arkadaşlar,

Excel 365 32 bit üzerinden vba makro ile listview yardımı ile tabloları oluşturdum tarih kutucukları ve kapatma butonu ekledim

Private Sub CommandButton_Click()
Unload Me
End Sub
Private Sub dtTar2_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)

End Sub

Private Sub dtTar2_CloseUp()
If dtTar1 > dtTar2 Then MsgBox "Son tarih ilk tarihten küçük olamaz", vbCritical + vbOKOnly, "UYARI": Exit Sub
Me.SatisListele
End Sub

Private Sub dtTar1_CloseUp()
If dtTar1 > dtTar2 Then MsgBox "Son tarih ilk tarihten küçük olamaz", vbCritical + vbOKOnly, "UYARI": Exit Sub
Me.SatisListele

End Sub
Private Sub Userform_Active()
Me.SatisListele

End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode <> True Then Cancel = False
End Sub
Sub SatisListele()
Dim ws As Worksheet
Dim wsss As Long
Dim stk As ListItem
Dim x As Long
Dim t1 As Date
Set ws = Sheets("Tarih")
wsss = ws.Range("A100000").End(x1up).Row
lstSatislar.ListItems.Clear
For x = 2 To wsss
t1 = ws.Range("A" & x).Value
If FormatNumber(dtTar1, 0) <= FormatNumber(t1, 0) And FormatNumber(dtTar2, 0) >= FormatNumber(t1, 0) Then
Set stk = lstSatislar.ListItems.Add(Text:=ws.Range("A" & x).Value)
stk.SubItems(1) = ws.Range("B" & x).Value
stk.SubItems(2) = ws.Range("C" & x).Value
stk.SubItems(3) = ws.Range("D" & x).Value
stk.SubItems(4) = ws.Range("E" & x).Value
stk.SubItems(5) = ws.Range("F" & x).Value
End If
Next

End Sub


Girdiğim kot bu

fakat run time error 1004 hatası alıyorum

me.SatısListele satırında sıkıntı çıkıyor bir türlü çözemedim yardımcı olur musunuz ?
 
Üst