perl, ole, excel's Find(), Q1

W

werwer

Getting help on this one has been tuff, so I'll take it in
steps.

I'm trying to use Excel's (2003) Find() function. This is what I
have so far.

sheets:
foreach my $ws (in $MyWorkbook->Sheets) {
print qq/Sheet $sheetName\n/;

# Can I get a range object and print a value?
my $cell = $ws->Range("A1");
my $ro = $cell->{Value};
print qq/TEST01 cell value $ro\n/;

$cell = $ws->Find('What:="2"', 'After:=ActiveCell',
'LookIn:=xlValues', 'LookAt:=xlPart', 'SearchOrder:=xlByRows',
'SearchDirection:=xlNext', 'MatchCase:=False',
'SearchFormat:=False');

# Nothing here.
$ro = $cell->{Value};
print qq/TEST0102 cell value $ro\n/;

} # sheets:


My 1st question is. Are the arguments to Find being constructed
correctly? Not are these the correct argunments, but is
'After:=ActiveCell'
properly formed. I tried other variations, no quotes, quotes, and
actually assigning a numeric value. Nothing seemed to work.
I've also tried every which way to enter that '2' in What:=

The above doesn't bomb, it just doesn't ever succeed.

Thanks
 
W

werwer

Well well... another post got it answered. THe key is the
function has to be called on a range object, as in

$ws->UsedRange->Find().

Thanks.
 
W

werwer

Another post answered it. find() must be called from, or on,
a range object like:

$ws->UsedRange->Find()

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top