reubanrao93
New Member
- Joined
- Dec 7, 2020
- Messages
- 20
- Office Version
- 365
- Platform
- Windows
Hi guys, I'm trying to find this specific string "ppl" inside column W and fill down column X with TRUE / FALSE text. However it identifies even "apple" or "people" as TRUE as well. How can i make this code to only detect "ppl"?
Thank you in advance
Sub Sample()
Dim LastRow As Long
Dim Ws As Worksheet
Set Ws = ThisWorkbook.Worksheets("Sheet2")
LastRow = Ws.Range("W" & Rows.Count).End(xlUp).Row
If InStr(1, Ws.Range("W1").Text, "ppl", vbBinaryCompare) > 0 Then
Ws.Range("X1:X" & LastRow).Formula = "TRUE"
Else
Ws.Range("X1:X" & LastRow).Formula = "FALSE"
End If
End Sub
Thank you in advance
Sub Sample()
Dim LastRow As Long
Dim Ws As Worksheet
Set Ws = ThisWorkbook.Worksheets("Sheet2")
LastRow = Ws.Range("W" & Rows.Count).End(xlUp).Row
If InStr(1, Ws.Range("W1").Text, "ppl", vbBinaryCompare) > 0 Then
Ws.Range("X1:X" & LastRow).Formula = "TRUE"
Else
Ws.Range("X1:X" & LastRow).Formula = "FALSE"
End If
End Sub