Hi, i have this code and im tryng to add another offset to check but doesn't work
For example the -2 Offset has "BlaBla 345W" i want to check if 345W is in the column E of sheet List
In BOLD the part that im tryng to add
For example the -2 Offset has "BlaBla 345W" i want to check if 345W is in the column E of sheet List
In BOLD the part that im tryng to add
Rich (BB code):
Sub Listing(chk As OLEObject)
Dim ViewSheet As Worksheet
Dim ListSheet As Worksheet
Dim ViewValue As Variant
Dim LeftWValue As Variant
Dim ValueFound As Boolean
Dim ValueExpired As Boolean
Dim ValueW As Boolean
Dim i As Long
Set ViewSheet = ThisWorkbook.Sheets("View")
Set ListSheet = ThisWorkbook.Sheets("List")
If TypeName(chk.Object) = "CheckBox" Then
ViewValue = chk.TopLeftCell.Offset(0, -1).Value
LeftWValue = chk.TopLeftCell.Offset(0, -2).Value Like "*W*"
ValueFound = False
ValueExpired = False
ValueW = False
For i = 1 To ListSheet.Range("A1").End(xlDown).Row
If ListSheet.Range("B" & i).Value = ViewValue Then
ValueFound = True
If ListSheet.Range("E" & i).Value = LeftWValue Then
ValueW = True
If ListSheet.Range("C" & i).Value < Date Then
ValueExpired = True
Else
ValueExpired = False
End If
End If
End If
Next i
End If
If ValueFound = True And ValueW = 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
Last edited by a moderator: