ExcelEveryday1
New Member
- Joined
- Jan 7, 2016
- Messages
- 20
Hi guys,
Instr doesnt seem to be matching properly for me, and I dont know what Im doing wrong. I get a match if my criteria value is the same as my search location value, but if the string is in the other string without matching it exactly, my code doesnt pick up on it.
----------------------------------------
dim cell as range
dim range1 as range
dim ws as worksheet
For Each cell In range1
If InStr(ws.Cells(10036, 4).Value, cell.Value) <> 0 Then
ws.Cells(10036, 2).Value = "freedom"
Else
End If
Next cell
-------------------------------------------
As an example of what I'm looking for:
(ws.Cells(10036, 4) = 2ABC_123
cell.value = "2ABC"
I also tried adding in an & "*" to my cell.value, but that didnt seem to help
Thanks
Instr doesnt seem to be matching properly for me, and I dont know what Im doing wrong. I get a match if my criteria value is the same as my search location value, but if the string is in the other string without matching it exactly, my code doesnt pick up on it.
----------------------------------------
dim cell as range
dim range1 as range
dim ws as worksheet
For Each cell In range1
If InStr(ws.Cells(10036, 4).Value, cell.Value) <> 0 Then
ws.Cells(10036, 2).Value = "freedom"
Else
End If
Next cell
-------------------------------------------
As an example of what I'm looking for:
(ws.Cells(10036, 4) = 2ABC_123
cell.value = "2ABC"
I also tried adding in an & "*" to my cell.value, but that didnt seem to help
Thanks