Results 1 to 5 of 5

Thread: Copy Row/Insert

  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have a challenge where I copy a row and insert it between rows that are grouped. After the insert, a new group is established. How do I prevent the new group from appearing? There is nothing in the code to create a new group.

    I have attached a sample file.

    Thanks,
    Johh
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    I think you'll have to remove the outline temporarily:

    Code:
    Sub Copy_Insert_Row()
      Const oNewRow = 15
      ' Remove outline
      Range("A12").ClearOutline
      ' Copy row
      Rows(8).Copy
      ' Insert/paste row
      Rows(oNewRow).Insert
      ' Recreate outline
      Range("A12").AutoOutline
    End Sub

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hans,

    The example file had only one grouping; my file has many groups. By using the line of code to "ClearOUtline", it removes all groupings. I'm interested in just that one grouping.

    Regards,
    John

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You'd have to figure out how to recreate the grouping in your situation...

  5. #5
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hans,

    I was able to come up with a work around where instead of copying the row; copy a range.

    In the example it would be Range("A8:E8"). This over comes the group challenge.

    Thank you,
    John

Posting Permissions

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