Hi i have problem with this code. Can someone help me?
Im tryng to check if value on the left cell from checkbox in sheet "View" is in a table on another sheet called "List" and if his date is expired... but every time i have the same result.
Im tryng to check if value on the left cell from checkbox in sheet "View" is in a table on another sheet called "List" and if his date is expired... but every time i have the same result.
VBA Code:
Sub Listing()
Dim ViewSheet As Worksheet
Dim ListSheet As Worksheet
Dim ViewValue As Variant
Dim ValueFound As Boolean
Dim ValueExpired As Boolean
Dim chk As oleObject
Set ViewSheet = ThisWorkbook.Sheets("View")
Set ListSheet = ThisWorkbook.Sheets("List")
If TypeName(chk) = "CheckBox" Then
ViewValue = ViewSheet.Cells(chk.TopLeftCell.Offset(0, -1)).value
ValueFound = False
ValueExpired = False
For i = 1 To ListSheet.Range("A1").End(xlDown).Row
If ListSheet.Range("B" & i).value = ViewValue Then
ValueFound = True
If ListSheet.Range("C" & i).value < Date Then
ValueExpired = True
Else
ValueExpired = False
End If
End If
Next i
End If
If ValueFound = True And ValueExpired = False Then
chk.TopLeftCell.Offset(0, 1)).value = "OK"
Else
MsgBox "Not in the List"
chk.Object = False
chk.TopLeftCell.Offset(0, 1)).value = "NOT OK"
End If
End Sub