Copy Range

  • .

    First ... you'll need to UNMERGE the cells. Keep in mind that MERGED CELLS always create issues. Best to never use them.


    Code
    Sub Paste_Range()
    Dim range_to_copy As Range, range_for_pasting As Range
    
    Set range_to_copy = Range("A2:F11")      '<-- edit range to copy here
    
        range_to_copy.Copy
        ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteAll
        
    End Sub
  • Thank you so much.

    But I made a classic mistake by not submitting exactly the same format of the table. Because as you can see in the attachement, the main table consists of 4 large sub-tables in the original table. They are separated by orange coloured rows. What I wanted was that the addition should be done at the end of these subsections, not at the end of the table. For example, when i click the button, sub section 1.5 would be added at the end of section 1. When i click the button once again sub section 1.6. And I want this to be repeated in other sections (Section 2, 3, and 4) It was my big mistake, I apologize. But if this happens, it will be very useful for me.

  • The classic mistake is really that you are ignoring all the rules for dealing with data in Excel.


    All data should be in a Table format with a header row.

    There should be no completely empty rows or columns within the data.

    Do not use merged cells.



    Stored correctly there are may ways to get the results that you want using formulas, SUBTOTAL and PivotTables.

  • Your post does not comply with our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.


    Post a link to any other forums where you have asked the same question.


    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.


    Go to https://www.excelguru.ca/content.php?184 to understand why we ask you to do this.


    I have added the crosspost reference for you today. Please comply with this and all our rules in the future


    crosspost: https://www.excelforum.com/exc…ithin-the-same-sheet.html

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!