I want to insert in a range a word based on two string variables searched in another range. Sometrhing like: If abc is found in range A to last row, then insert in range B to last row the word good, if not also insert the word good.
And if in the same range A to last row is found xyz string, then skip the part wich inserts the word good, and run the part that inserts word bad, not the word good.
I have tried somethig like this but, I don't know hot to skip the first part if the second string is found.
Dim rng As Range
Set rng = ActiveSheet.Range("F2:F" & Range("F" & Rows.Count).End(xlUp).Row)
For Each Cell In rng.Cells
If InStr(1, Cell, "vf7") > 0 Then
Cell.Offset(0, 2).Value = "CIT"
ElseIf InStr(1, Cell, "VF7") > 0 Then
Cell.Offset(0, 2).Value = "CIT"
Else
Cell.Offset(0, 1).Value = "CIT"
End If
Next
For Each Cell In rng.Cells
If InStr(1, Cell, "vf3") > 0 Then
Cell.Offset(0, 2).Value = "PGT"
ElseIf InStr(1, Cell, "VF3") > 0 Then
Cell.Offset(0, 2).Value = "PGT"
Else
Cell.Offset(0, 2).Value = "PGT"
End If
Next
THX
Aucun commentaire:
Enregistrer un commentaire