Need to insert a line and copy the data from a range in the line above it in excel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tmara
    New Member
    • Jul 2014
    • 1

    #1

    Need to insert a line and copy the data from a range in the line above it in excel

    I am working on a complex decision tree in excel, and each time I add a question the number of lines doubles. For this reason I am trying to write a macro to insert the new lines, copy data from existing lines, and pasting it into the new lines.

    I wrote some psuedo code that I think works logically, but am not familiar with the syntax of visual basic.

    Psuedo code:
    Find last row in sheet
    Determine new last row (last row * 2 - 1) %the first row is titles
    newRow % Set the location of the first row to be inserted (line 3)
    While the row count is less than or equal to the new last row number
    insert newRow
    Copy range A:K of the row above newRow into AnewRow:KnewRow
    Increment newRow by 2 to skip one line
    End while

    Can someone please help me with this?
Working...