+ Reply to Thread
Results 1 to 6 of 6

How do I select and paste to the last column ?

  1. #1
    Registered User
    Join Date
    03-25-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    47

    How do I select and paste to the last column ?

    I have a small list of data that has duplicates
    The data is in columns A to Y and about 16 rows
    I want to select one of the duplicates and move it to another sheet and placing it on the last available row
    That part is done
    What I am having a problem with is getting the second duplicate and paste it to the next empty cell in the same row as the first duplicate
    I am trying to use the vba version but I am not sure if I am doing it right
    I am getting to the cell but I am getting an error 1004 when it's trying to paste the data
    I attached a screenshot of the error
    Attached Images Attached Images

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: How do I select and paste to the last column ?

    In your code you are copy whole row, this van not be pasted in 1 cell.

    Kind regards
    Leo

  3. #3
    Registered User
    Join Date
    03-25-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: How do I select and paste to the last column ?

    Thanks for finding the problem
    Is there an easy workaround for this ?
    how can I change the statement after the if statement to select only that range so it doesn't copy the entire row but not specify a cell range because that will change
    Just copy the range up to the cell that contains the value 1 without referencing a cell address

  4. #4
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: How do I select and paste to the last column ?

    Maybe change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    kind regards
    Leo

  5. #5
    Registered User
    Join Date
    03-25-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: How do I select and paste to the last column ?

    That does get rid of the error but now I only get one cell just whatever is in cell 24 of that row
    I need to copy that range 1 to 24 of that row

  6. #6
    Registered User
    Join Date
    03-25-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: How do I select and paste to the last column ?

    I think I got it to work
    I used the resize to limit the size of the row
    So this is the replacement for the original statement from Worksheets("Data").rows(I).copy to
    Worksheets("DATA").Rows(I).Resize(1, 25).Copy

    I also changed the paste area
    from Worksheets("STO").Cells(B + 1, 1).Select
    to
    Worksheets("STO").Cells(B, 26).Select
    This will place the new row in line and right after the first row

+ 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. Select which column & row to paste value according the date
    By mbime in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-25-2014, 06:57 AM
  2. [SOLVED] select 365th rows and paste it in another column
    By kuntalnr in forum Excel General
    Replies: 9
    Last Post: 04-18-2014, 10:25 AM
  3. Select (one) Row where a column has a value in it. Paste one row below it.
    By saturos in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-05-2013, 01:09 AM
  4. Select the last row in a column with data nd paste the value in the rest of the column
    By Sheldon Brooks in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-25-2013, 05:33 AM
  5. VBA - Paste / Select Column / Currency / format
    By rik1313 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 10-09-2012, 04:49 AM
  6. VB help SELECT COLUMN / PASTE FORMULA'S
    By XL XL in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-23-2010, 09:14 AM
  7. Select empty column & paste - Help please
    By saziz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-20-2005, 02:55 PM

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