Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Jan 2007
    Location
    Gray, Louisiana, USA
    Posts
    289
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Insert row and copy from cell above (2000/2003)

    I have a small workbook attached that, I hope, explains what I need. I appreciate any help, thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Insert row and copy from cell above (2000/2003)

    1) Enter the formula

    =ROW()-4

    in cell A5 and fill down.

    2) Create the following macro and assign it to the button:

    Sub InsertARow()
    ActiveCell.EntireRow.Copy
    ActiveCell.Offset(1, 0).EntireRow.Insert
    Application.CutCopyMode = False
    End Sub

  3. #3
    2 Star Lounger
    Join Date
    Jan 2007
    Location
    Gray, Louisiana, USA
    Posts
    289
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert row and copy from cell above (2000/2003)

    Thanks this is perfect.

    What does the -4 mean after Row()

  4. #4
    2 Star Lounger
    Join Date
    Jan 2007
    Location
    Gray, Louisiana, USA
    Posts
    289
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert row and copy from cell above (2000/2003)

    A thing of beauty---Thanks again

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Insert row and copy from cell above (2000/2003)

    The ROW() function returns the row number of the cell containing the formula.
    So in cell A5, ROW() returns 5. Since you want numbering to start with 1 in cell A5, we subtract 4 from the row number.
    The advantage of using ROW() is that it doesn't matter if rows are inserted or deleted - the numbering will adjust automatically.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •