Try this code: It will return the value of the cell where the match occurred

Option Explicit

Dim oXL, oWB, oWs, oRange, oTgt, str_addr, strFirstAddress
Set oXL = CreateObject("Excel.Application")

Set oWB = oXL.Workbooks.Open("C:\test.xls")
Set oWS = oWB.Worksheets("Sheet1")

Set oRange = oWS.UsedRange

Set oTgt = oRange.Find("<VALUE TO BE SEARCHED>") 'The value to be searched
for

If Not oTgt Is Nothing Then
 Wscript.Echo oTgt.AddressLocal(False,False)
 strFirstAddress = oTgt.AddressLocal(False,False)
End If

Do Until (oTgt Is Nothing)
 Set oTgt = oRange.FindNext(oTgt)
 str_addr = oTgt.AddressLocal(False,False)
 If str_addr = strFirstAddress Then
 Exit Do
End If

msgbox oTgt.AddressLocal(False,False)
Loop
oXL.Quit
Set oXL = Nothing

Regards,
Gautham Maroli


On Wed, Jul 30, 2014 at 12:38 AM, Udhaya Kumar <[email protected]>
wrote:

> Hi,
>
> When excel sheet having more cells with yes or no values in cell content.
>
> If I want to find the cell which has value yes. Which will be the best
> method?
>
> Whether we can use for loop with cell count or any other way
>
> Regards,
> Udhay
> On 29 Jul 2014 19:37, "Akhalesh Yadav" <[email protected]>
> wrote:
>
>> you can use excel.usedrow method to count the used row cell in excelsheet.
>>
>>
>> Thanks..
>> Akhalesh
>>
>>
>> On Mon, Jul 28, 2014 at 2:46 PM, Udhaya Kumar <[email protected]
>> > wrote:
>>
>>> Hi All,
>>>
>>> what is the best way to write function for reading value from excel
>>> column cell.
>>>
>>>
>>> Instead of using *rowcount* and *columncount*, any other way to read
>>> cell value without affecting the performance of the excel application.
>>>
>>> [image: Inline image 1]
>>>
>>> Regards,
>>> Udhay
>>>
>>> --
>>> --
>>> You received this message because you are subscribed to the Google
>>> "QTP - HP Quick Test Professional - Automated Software Testing"
>>> group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/MercuryQTP?hl=en
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "QTP - HP Quick Test Professional - Automated Software Testing"
>>> group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Akhalesh yadav
>> +919555717928
>> +919310680659
>>
>> --
>> --
>> You received this message because you are subscribed to the Google
>> "QTP - HP Quick Test Professional - Automated Software Testing"
>> group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/MercuryQTP?hl=en
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "QTP - HP Quick Test Professional - Automated Software Testing" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>  --
> --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/MercuryQTP?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "QTP - HP Quick Test Professional - Automated Software Testing" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

--- 
You received this message because you are subscribed to the Google Groups "QTP 
- HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to