Reputation: 2300
I have data in some cells in column B that look like Id# plus some number e.g 'Id# 85'
All the other cells have names in them FirstName LastName
I need to find the cells that have Id# in them, I am trying the following, but not working
Thanks
Sub test()
Dim ws As Worksheet
Dim i As Long
Set ws = ThisWorkbook.Sheets("Elements")
With ws
For i = 2 To 180
If .Cells(i, "B").Text Like "Id#" & "*" Then Do something
Next i
End With
End Sub
Upvotes: 1
Views: 626
Reputation: 2321
Try this:
Sub test()
Dim ws As Worksheet
Dim i As Long
Set ws = ThisWorkbook.Sheets("Elements")
With ws
For i = 2 To 180
If Left(.Cells(i, "B").Text, 3) = "Id#" Then
.Cells(i, "C").Value = True
End If
Next i
End With
End Sub
Upvotes: 2