KFFrench
asked on
Can't call method "Range" on an undefined value
I can't seem to get past this point in my code. For some reason Perl is unable to read some cells of the data in an Excel spreadsheet and returns the error: Can't call method "Range" on an undefined value. Here is the code I'm using:
my $Sheet = $Book->Worksheets ("Data");
my @CF = ($ID, $SO, $LI, $QT, $CR->Date(DATE_SHORTDATE), $CR->Time,
$MOD->Date(DATE_SHORTDATE) , $MOD->Time);
sub GetCF($){
my ($tgtRows)= @_;
my $Sheet;
Return ($Sheet->Range("A".$tgtRow s)->{'Valu e'},
$Sheet->Range("L".$tgtRows )->{'Value '},
$Sheet->Range("M".$tgtRows )->{'Value '},
$Sheet->Range("S".$tgtRows )->{'Value '},
$Sheet->Range("V".$tgtRows )->{'Value '},
$Sheet->Range("Z".$tgtRows )->{'Value '});
my $Sheet = $Book->Worksheets ("Data");
my @CF = ($ID, $SO, $LI, $QT, $CR->Date(DATE_SHORTDATE),
$MOD->Date(DATE_SHORTDATE)
sub GetCF($){
my ($tgtRows)= @_;
my $Sheet;
Return ($Sheet->Range("A".$tgtRow
$Sheet->Range("L".$tgtRows
$Sheet->Range("M".$tgtRows
$Sheet->Range("S".$tgtRows
$Sheet->Range("V".$tgtRows
$Sheet->Range("Z".$tgtRows
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Sorry but I don't know the Excel modul at all. So I'm afraid I can't help you any further.
If you don't bother about the points, just post the new problem in a new question. If you do bother, ask in
https://www.experts-exchange.com/Community_Support/
to undo the accept and reopen the question. Other experts won't read this and provide answers as long as the question is marked as accepted.
If you don't bother about the points, just post the new problem in a new question. If you do bother, ask in
https://www.experts-exchange.com/Community_Support/
to undo the accept and reopen the question. Other experts won't read this and provide answers as long as the question is marked as accepted.
ASKER
our $Sheet = $Book->Worksheets ("Data");
my @CF = ($ID, $SO, $LI, $QT, $CR->Date(DATE_SHORTDATE),
$MOD->Date(DATE_SHORTDATE)
sub GetCF($){
my ($tgtRows)= @_;
our $Sheet;
Return ($Sheet->Range("A".$tgtRow
$Sheet->Range("L".$tgtRows
$Sheet->Range("M".$tgtRows
$Sheet->Range("S".$tgtRows
$Sheet->Range("V".$tgtRows
$Sheet->Range("Z".$tgtRows
@CF=GetCF($Rows);
while ($Sheet->Range("A". ++$Rows)->{'Value'}){
my @CF = GetCF($Rows);
if (!exists $tmphash {$CF[1]}->{$CF[2]}){
print $CF [1][2];
}
}