First let me describe my program I Grab it From a Config File using this regex
if(/;;HPLCColumn;;([0-9]+);/){ if ($number == 2){ $HPLC_Collum= $1; $number ++; }else { die ; }
I then pass it to the function.  capconverter($excelfile ,$HPLC_to_UV_Factor ,$HPLC_Collum ,$UV_Collum ,$Data_row_start);
I then use it in the fuction as so
sub capconverter { my($excelfile ,$HPLC_to_UV_Factor ,$HPLC_Collum ,$UV_Collum ,$Data +_row_start)=@_; my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); my $Book = $Excel->Workbooks->Open($excelfile); $Excel->{DisplayAlerts}=0; my $WorkBooknumber = 6; my $Sheet = $Book->Worksheets($WorkBooknumber); # your work sheet numb +er my $rowholder = $Data_row_start; while ((defined ($Sheet->Cells($rowholder,1)->{'Value'}))){#&&( define +d ($Sheet->Cells($rowholder,$HPLC_Collum)->{'Value'}))){ $Sheet->Cells($rowholder, 19)->{'Value'}= ($Sheet->Cells($rowholder,$H +PLC_Collum)->{'Value'} *$HPLC_to_UV_Factor); #to UV Calculation $rowholder ++; } $Book->SaveAs($excelfile); $Book->Close; }
Which gives me the following error
Win32::OLE(0.1709) error 0x800a03ec in METHOD/PROPERTYGET "Cells" at C:\Documents and Settings\KHusban +d\Desktop\ New Folder\exceel.pl line 272
How ever if i switch the code from $Sheet->Cells($rowholder,$HPLC_Collum)->{'Value'} to ($Sheet->Cells($rowholder,18)->{'Value'} It works.
My question is why is this and how can i get the value to be passed in threw the function. When i print  $HPLC_Collum it return the value of 18 which is expected.
--Thanks
BlueInk

In reply to Cannot seem to pass number to a function by BlueInk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.