If InStr(1, UCase(CStr(compare_DU_ID)), "L4L", 1) >= 1 Then
If UCase(CStr(compare_DU_ID)) = UCase(CStr(DU_ID)) Then 'If L4L in compare_DU_ID, then DU_ID definitely equals to compare_DU_ID
Worksheets("Sheet2").Cells(y, 97).Value = Updated_Date '1. Cells(y, 97) might need to change, depending on which contract date you want to update
End If
ElseIf InStr(1, CStr(compare_DU_ID), CStr(DU_ID), 1) = 1 Then
Worksheets("Sheet2").Cells(y, 97).Value = Updated_Date
ElseIf InStr(1, CStr(DU_ID), CStr(compare_DU_ID), 1) = 1 Then
Worksheets("Sheet2").Cells(y, 97).Value = Updated_Date
End If
I have a problem to update the date. For instances, 1st scenario, if the CStr(DU_ID) = 1731WG and CStr(compare_DU_ID) = 31731WG, then the date won't be updated. 2nd scenario, when CStr(DU_ID) = 1392WG and CStr(compare_DU_ID) = 11392WG, the date will be updated ..
What do I need to adjust to the code, so that second scenario won't be changed as well ...
Also, I seriously think that 11392WG will be updated is because it starts with "1", so is 1392WG. And 31731WG won't be changed is because it doesn't start with "1", which is the first value of 1731WG ..
Aucun commentaire:
Enregistrer un commentaire