Hello guys,
I am fairly new to VBA.
Thank you for providing a Forum to share ideas.
Regards
RJuma
Hello guys,
I am fairly new to VBA.
Thank you for providing a Forum to share ideas.
Regards
RJuma
Last edited by RJuma; 03-28-2017 at 09:01 AM.
Hello RJuma,
Welcome to Excelforum. Be a part of large Excel community. Enjoy Learning.
If I have helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
I am searching for text in rows of column B and want to assing values in corresponding rows in column D if the text is found. For instance, if my search criteria is "House", then I want to assign rows in column D the value "Equal match" if the text equals the row value and assing the value "Text found" if the search criteria exists in row for exaple if cell value is "The big House". I have used the below code but it classifies every rows as an "Equal match". Please help . Thanks!!
strSearch = "House"
For k = 1 To lrow
With ws
If Cells(k, 2).Value Like "*" & strSearch & "*" Then
' If Not Cells(k, 2).Value Is Nothing Then
For j = 1 To Len(Cells(k, 2).Value)
sPos = InStr(i, Cells(k, 2).Value, strSearch)
sLen = Len(strSearch)
If (sPos <> 0) Then
Cells(k, 4).Value = "Text found"
Cells(k, 2).EntireRow.Interior.ColorIndex = 27
r = sPos + Len(strSearch) - 1
End If
Next j
' End If
ElseIf Cells(k, 2).Value = strSearch Then
Cells(k, 4).Value = "Equal match"
Else
End If
End With
Next k
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks