in reply to Excel range finding problem

Split up the chain of accesses into separate statements:

my $range = $worksheet -> UsedRange or die "No UsedRange found for $worksheet"; my $findresult = $range -> Find({What => "*", SearchDirection => xlPre +vious, SearchOrder => xlByRows}) or die "No result found for '*'"; my $row = $findresult -> {Row}; defined $row or die "No row found from $findresult"; my $col = $last_col = $findresult -> {Column}; defined $col or die "No col found from $findresult";

This way, you don't have to climb down the chain to your search results twice even.

Also, I think I remember that a Range object in VBA has properties that give you the coordinates of the lower right cell directly. Maybe extract it from $range->{Address}...

Replies are listed 'Best First'.
Re^2: Excel range finding problem
by merrymonk (Hermit) on Oct 05, 2015 at 13:52 UTC
    Thanks - I will try that and see what happens.