in reply to Win32::OLE Excel formula Copy

Since you already can get the formula and you can figure out the new row somehow so you just need to change row then use of substitution might work. Similar for columns.
$Formula1= $Sheet->Range('A499')->{Formula}; $new_row = 500; $Formula1 =~ s/\d+/$new_row/g; $Sheet->Range('A'.$new_row)->{Formula} = $Formula1;

Regards,
s++ą  ł˝ ął. Ş ş şą Żľ ľą˛ş ą ŻĽąş.}++y~-~?-{~/s**$_*ee

Replies are listed 'Best First'.
Re^2: Win32::OLE Excel formula Copy
by srivasva (Novice) on Nov 25, 2008 at 14:04 UTC
    Thanks for the solution. But I am looking for a more generic solution as I have around 50 different formulas to be substituted with new row and they are spread into different columns . eg.
    =IF(C489=0,0,(ABS(C492-C489)/C489))
    in the above formula above substitution $Formula1 =~ s/\d+/$new_row/g; will not work.
      If you want the behaviour of the copy & paste mechanism, you should try to use that: select the cells, copy them, move the cursor to another cell, paste there.

      I'm not familiar with OLE at all, but I'm quite sure that this has to work somehow, and I even suspect you'll find some code examples if you search hard enough.