I have two worksheets, first “LoC” in column “A” i have names, I would like to update column “M” and add “YES” if below conditions were met.
If in worksheet “APME” in column “L” in string have name from column “A” of tab “LoC” and if in column “J” of tab “APME” I have amount.
Here is my code, i don’t know where i made mistake. Can anyone help me?
Sub InString_two_conditions()
Dim cell As Range
Dim cell_2 As Range
Dim i As Long
Dim criteria1 As Range
LastRowLoC = ThisWorkbook.Sheets("LoC").Cells(Rows.Count, 1).End(xlUp).Row
LastRowAPME = ThisWorkbook.Sheets("APME").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To LastRowLoC
Set criteria1 = ThisWorkbook.Sheets("LoC").Cells(i, 1)
For Each cell In ThisWorkbook.Sheets("APME").Range("L3:L" & LastRowAPME)
If InStr(UCase(cell.Value), UCase(criteria1)) > 0 And cell.Offset(0, -2).Value <> 0 Then
ThisWorkbook.Sheets("LoC").Cells(i, 13) = "Yes"
End If
Next cell
Next i
End Sub
I don’t know where i made mistake in my code. Can anyone help me?
user27364877 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
6