Win32 and Excel question

Simon Brunning SBrunning at trisystems.co.uk
Wed Apr 10 04:48:16 EDT 2002


> From:	Matthew [SMTP:matthewm at ihug.co.nz]
> I'm playing with win32COM with a little success. I have a large XL table
> with 8 columns and about 3500 rows. What I want to do is search only
> column B for a value and return the row number where this value is
> found. So, I have 2 questions:-
> 1) Howto construct a Win32COM statement to do this? So far I have this:-
> 
> >>>
> found=myxl.ActiveSheet.Range("B1:B3500").Find(<value_i'm_looking_for>
> However, this search finds the first match in any column between B1 and
> B3500. Yep, their are similar values in other cells of the s/s
> >>> found.Row
> 25
> >>> found.Column
> 1 (ie: Column 'A')
> Help please.
> 2) Howto return a tuple of all values in only column 'B' and then use
> python to search the tuple for the value I'm after. It strikes me that
> this is probably a faster approach?
 
I reccomend that you get a copy of "Python Programming on Win32" if you
don't already have it. It contains a very useful helper class for accessing
Excel. I have a version with a couple of additional methods - I'll send it
to you directly.
 
> BTW: Thanks Mark Hammond for a v.cool and useful tool.
 
Seconded.

Cheers,
Simon Brunning
TriSystems Ltd.
sbrunning at trisystems.co.uk




-----------------------------------------------------------------------
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.





More information about the Python-list mailing list