+ Reply to Thread
Results 1 to 4 of 4

Paste to first empty row in a table (NOT at the end of the table range)

Hybrid View

  1. #1
    Registered User
    Join Date
    04-30-2014
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    70

    Paste to first empty row in a table (NOT at the end of the table range)

    Hi all -

    I have some code which I actually created just by recording a macro and then making some slight modifications to it. One of the primary functions of it is that it takes a range of data from one sheet and then appends it to the bottom of a similar range of data on another sheet.

    The behavior I need is that it will find the first empty cell in column A and then begin to paste what is in the clipboard there.

    This code is working for me to do that. The problem is that I want to make the destination location into a table. When it is in a table (and the table range extends below the last row of data) my code doesn't work. It ends up pasting the data at the row where the table range ends. I need it to paste it where the data ends, not the table range.

    Here is the portion of my code that is relevant I think.

        Selection.Copy    
        Sheets("Store Count & Comp Ref").Select
        Range("a1000000").End(xlUp).Offset(1, 0).Select
        Selection.PasteSpecial Paste:=xlPasteValues
    Can this be modified so that it will do what I need when I have the destination being formatted as a table?

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Paste to first empty row in a table (NOT at the end of the table range)

    Use double EndUp for finding the last used row of the Table

    Selection.Copy
    Sheets("Store Count & Comp Ref").Range("a1000000").End(xlUp).End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    04-30-2014
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Paste to first empty row in a table (NOT at the end of the table range)

    Quote Originally Posted by :) Sixthsense :) View Post
    Use double EndUp for finding the last used row of the Table

    Selection.Copy
    Sheets("Store Count & Comp Ref").Range("a1000000").End(xlUp).End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues
    BOOOOM!! How simple! I should have thought of that.

    Works perfect. Thanks SixthSense!

  4. #4
    Forum Contributor
    Join Date
    06-04-2013
    Location
    Moscow
    MS-Off Ver
    Office 365
    Posts
    100

    Re: Paste to first empty row in a table (NOT at the end of the table range)

    For any Excel version:
    Selection.Copy
    With Sheets("Store Count & Comp Ref")
    .Range(.Rows.Count,1).End(xlUp).End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues
    End With
    Last edited by The_Prist; 05-18-2015 at 05:40 AM.
    I'm sorry my english...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Pivot table dynamic range empty row
    By greengirl in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-11-2014, 11:08 AM
  2. Paste recordset on next empty row inside a table
    By baijixu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-22-2014, 03:13 PM
  3. Need to Remove Empty Table Rows Before Paste of New Data
    By snapfade in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 02-06-2014, 04:55 PM
  4. Replies: 3
    Last Post: 11-13-2012, 04:43 PM
  5. Replies: 5
    Last Post: 06-07-2012, 05:18 AM

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