copy and paste cell in code

2 posts, 0 answers
  1. Neil
    Neil avatar
    2 posts
    Member since:
    Feb 2016

    Posted 06 Mar 2016 Link to this post


      I want to be able to grammatically copy a range of cells down several rows and have the formula's update automatically.  

    I can get to the cells i want to copy and their formulas with code like


                                var dataSheet = sheetKendo.sheetByName("sheet1");
                                var sourceRange= dataSheet.range("A1");
                                var val = rowCountRange.value();
                                var formula = rowCountRange.formula(); // =Len(B1) + 2

    How could I copy A1 to A2 and have the resulting formula in A2 =Len(B2)+2 in code, eg the same way as you drag down the black cross when doing this manually in the ui. 

     I know I could do it manually by setting the formula of A2 manually but it would mean I would have to parse and change the formula from A1.


    Thanks for any help 



  2. Neil
    Neil avatar
    2 posts
    Member since:
    Feb 2016

    Posted 07 Mar 2016 in reply to Neil Link to this post

    I worked it out, the following code will copy the range down 

                                    command: 'AutoFillCommand',
                                    options: {
                                        operatingRange: dataSheet.range("i4:l6"),
                                        origin: dataSheet.range("i3:l3")

Back to Top