Hi everyone
I need to add a text to the column C if the text in column F like P-D, or P-E so on. I have done the code but nothing has occurred and I think it may be because of the hyphen. I want to make the criteria either P-E or P-K or P-H then shows as 'No', however I am unsure should I use OR or AND in such case. Please could anyone advise? Many thanks.
I need to add a text to the column C if the text in column F like P-D, or P-E so on. I have done the code but nothing has occurred and I think it may be because of the hyphen. I want to make the criteria either P-E or P-K or P-H then shows as 'No', however I am unsure should I use OR or AND in such case. Please could anyone advise? Many thanks.
Code:
Sheets("Data").Select
Dim i As Long
Dim lastrow As Long
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lastrow
If Cells(i, 6).Value Like "P-D" Then
Cells(i, 3).Value = "Yes"
ElseIf Cells(i, 6).Value Like "P-E" And Cells(i, 6).Value Like "P-K" And Cells(i, 6).Value Like "P-H" Then
Cells(i, 3).Value = "No"
ElseIf Cells(i, 6).Value = "P-S" And Cells(i, 6).Value Like "P-T" And Cells(i, 6).Value Like "P-M" Then
Cells(i, 3).Value = "Done"
Else: Cells(i, 3).Value = "Others"
End If
Next I