+ Reply to Thread
Results 1 to 13 of 13

Macro to Copy Range and Paste in the Empty Row Same Sheet

Hybrid View

  1. #1
    Registered User
    Join Date
    10-24-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    56

    Post Macro to Copy Range and Paste in the Empty Row Same Sheet

    Hi

    I would like to copy range A8:J15 to a the next empty row in the same sheet.

    Any ideas?

    Thanks
    Last edited by kaurka; 04-22-2013 at 11:02 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to Copy Range and Paste in the Empty Row Same Sheet

    Try this
    With Worksheets("Sheet1")
        .Range("A8:J15").Copy .Range("A" & .Rows.Count).End(xlUp).Offset(1, 0)
    End With
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    10-24-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Macro to Copy Range and Paste in the Empty Row Same Sheet

    I forgot to mention in the range i have merged cells.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to Copy Range and Paste in the Empty Row Same Sheet

    Do you have a sample that you can upload?

    Also can you show us where you want the data to be pasted?

  5. #5
    Registered User
    Join Date
    10-24-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Macro to Copy Range and Paste in the Empty Row Same Sheet

    I dont have a sample i can upload.

    But i would like to do the same as the code below for columns:

    Sub CopyCol()
    Dim i As Long
    
    i = Cells(2, Columns.Count).End(xlToLeft).Column
    Range("E2:H30").Copy
    Cells(2, i + 4).PasteSpecial Paste:=xlPasteAll
    Application.CutCopyMode = False
    
    End Sub

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to Copy Range and Paste in the Empty Row Same Sheet

    Try
    With Worksheets("Sheet1")
        .Range("A8:J15").Copy
        .Range("A" & .Rows.Count).End(xlUp).Offset(1, 0).pastespecial(xlpastevalues)
    End With

  7. #7
    Registered User
    Join Date
    10-24-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Macro to Copy Range and Paste in the Empty Row Same Sheet

    Getting an error

    To do this, all the merged cells need to be the same size

  8. #8
    Registered User
    Join Date
    10-24-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Macro to Copy Range and Paste in the Empty Row Same Sheet

    My range also has all the formatting and formulas that i would like to copy

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to Copy Range and Paste in the Empty Row Same Sheet

    Its better you attach a sample.

  10. #10
    Registered User
    Join Date
    10-24-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Macro to Copy Range and Paste in the Empty Row Same Sheet

    See the attachment below

    Issue List.xlsm

  11. #11
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to Copy Range and Paste in the Empty Row Same Sheet

    "To do this, all the merged cells need to be the same size"

    The error message is: Need to unmerge cells.

  12. #12
    Registered User
    Join Date
    10-24-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Macro to Copy Range and Paste in the Empty Row Same Sheet

    I have done this before with columns. See the CODE above

  13. #13
    Registered User
    Join Date
    10-24-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: Macro to Copy Range and Paste in the Empty Row Same Sheet

    I just figured it our myself but thanks for all your input.

    Here's the Code:

    Sub CopyRow()
    Dim i As Long
    
    i = Cells(Rows.Count, 1).End(xlUp).Row
    Range("A8:J15").Copy
    Cells(i + 8, 1).PasteSpecial Paste:=xlPasteAll
    Application.CutCopyMode = False
    
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1