Hi,
I have a problem with this code below. The code should load data 5 days before the date from the table in column "E", instead it is loading all of the data. I have also provided a screenshot in the link. Please, if anyone can help, it'll be helpful.
https://imgur.com/IWZ140c
Best Regards
I have a problem with this code below. The code should load data 5 days before the date from the table in column "E", instead it is loading all of the data. I have also provided a screenshot in the link. Please, if anyone can help, it'll be helpful.
Code:
Private Sub UserForm_Initialize()
Dim LRow As Integer
Dim LDiff As Integer
Dim LDays As Integer
LRow = 4 'start at row 2
LDays = 5 'Warning - Number of days to check for expiration
ThisWorkbook.Activate
With ListView2
.HideColumnHeaders = True
.Appearance = ccFlat
.ColumnHeaders.Clear
.View = lvwReport
.FullRowSelect = False
.HideSelection = True
.Gridlines = True
.ColumnHeaders.Add , , "Due Since", 110
.ColumnHeaders.Add , , "Clients-Nr", 72, Alignment:=1
.ColumnHeaders.Add , , "Clients-Nr", 0, Alignment:=1
End With
' Adds data ** Sheet11 = Sheets("Rent_Pay_DB") Sheets("Rent_Pay_DB").Cells(Row, 12) > "0.00"
ListView2.ListItems.Clear
row = 4
Do Until Sheets("Rent_Pay_DB").Cells(row, 5) = ""
' If Len(Sheets("Rent_Pay_DB").Range("E" & LRow).Value) > 0 Then
LDiff = DateDiff("d", Date, Sheets("Rent_Pay_DB").Range("E" & LRow).Value)
If (LDiff < 0) And (LDiff <= LDays) And (Sheets("Rent_Pay_DB").Cells(row, 13) > "0.00") Then
Set Li = ListView2.ListItems.Add(Text:=Format(Sheet11.Cells(row, "A").Value, "General")) 'Property Address
Li.ListSubItems.Add Text:=Format(Sheet11.Cells(row, "M").Value, "#,##0.00")
Li.ListSubItems.Add Text:=Format(Sheet11.Cells(row, "E").Value, "m/d/yyyy")
End If
' End If
row = row + 1
Loop
End Sub
https://imgur.com/IWZ140c
Best Regards