When I run this code &buildexcel("Age"); ... sub buildexcel{ ... my $sheet=$book->worksheets('AgeRaw') if ($_[0] eq "Age"); my $sheet=$book->worksheets('ReceiptsRaw') if ($_[0] eq "Cash"); $sheet->activate(); ... } I get this error ... Can't call method "activate" on an undefined value at armonth.pl line 92 <AGE> line 17904. If I comment out my $sheet=$book->worksheets('ReceiptsRaw') if ($_[0] eq "Cash"); then it executes correctly. This is really confusing me since the only thing being passed to the subroutine is "Age" so the "Cash" if should never ever execute. But it seems that it is checking it and then setting $sheet to null or something when the condition comes back false. I am Paul Kraus Network Administrator PEL Supply Company 216.267.5775 Voice 216-267-6176 Fax www.pelsupply.comThread Next