11-21-2012, 03:05 AM
Hello,
I am trying to find a word in string in excel cell.
That means if i have " I like qtp" and i am looking for "qtp" how can i find in excel.
below code works only if i have "qtp" in cell. if i have a sentence along with qtp it does not work.
Please help.
I am trying to find a word in string in excel cell.
That means if i have " I like qtp" and i am looking for "qtp" how can i find in excel.
below code works only if i have "qtp" in cell. if i have a sentence along with qtp it does not work.
Please help.
Code:
Dim xl
t = "qtp"
Set xl = createobject("excel.application")
xl.Visible = true
Set sd = xl.Workbooks.Open ("F:\us\FP.xls")
Set st = sd.Worksheets("Sheet1")
rows = st.usedrange.rows.count
coloumn = st.usedrange.columns.count
msgbox t
For i = 1 to rows
For j = 1 to 2
If st.cells(i,j) = t Then
msgbox "find"
End If
Next
next