+ Reply to Thread
Results 1 to 12 of 12

copy last column

  1. #1
    Registered User
    Join Date
    08-27-2009
    Location
    Gib
    MS-Off Ver
    Excel 2007
    Posts
    62

    Question copy last column

    Hi,
    I need a vba code for selecting the last column with data in the file and copying it to a different column in a different sheet : sheet 3 column A
    thanks
    Last edited by Abroza; 09-22-2009 at 07:56 AM.

  2. #2
    Forum Contributor vijay2482's Avatar
    Join Date
    03-03-2009
    Location
    Paris,France
    MS-Off Ver
    Excel 2003
    Posts
    263

    Re: copy last column

    Hi,

    Is the last column in the file always the same?
    If so, which column is it?

  3. #3
    Forum Contributor vijay2482's Avatar
    Join Date
    03-03-2009
    Location
    Paris,France
    MS-Off Ver
    Excel 2003
    Posts
    263

    Re: copy last column

    Assuming your selection range is B1:B50
    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717

    Re: copy last column

    Try this

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-27-2009
    Location
    Gib
    MS-Off Ver
    Excel 2007
    Posts
    62

    Question Re: copy last column

    the column isn't the same, it changes so I can't use the code you gave me.
    I tryed this code, I don't know why but it select the first column with data (A) and no the last one,
    can someonee look at this and help:

    Please Login or Register  to view this content.
    thanks

  6. #6
    Forum Contributor vijay2482's Avatar
    Join Date
    03-03-2009
    Location
    Paris,France
    MS-Off Ver
    Excel 2003
    Posts
    263

    Re: copy last column

    Please Login or Register  to view this content.
    in the above code End(xlToLeft) has to be changed to End(xlToRight), but it will give you the last column of your sheet.
    you will have to specify the usedrange of the sheet to get the desired output.

  7. #7
    Forum Contributor vijay2482's Avatar
    Join Date
    03-03-2009
    Location
    Paris,France
    MS-Off Ver
    Excel 2003
    Posts
    263

    Re: copy last column

    Abroza,

    I executed the code, that you have posted and found that it works fine.
    Do not replace left to right.

    Vijay

  8. #8
    Registered User
    Join Date
    08-27-2009
    Location
    Gib
    MS-Off Ver
    Excel 2007
    Posts
    62

    Re: copy last column

    for me it still selects the first column A, all the way to the last row, instead of selecting the last column all the way to the last row!
    any suggestions?

  9. #9
    Forum Contributor vijay2482's Avatar
    Join Date
    03-03-2009
    Location
    Paris,France
    MS-Off Ver
    Excel 2003
    Posts
    263

    Re: copy last column

    Abroze,

    I found that Shijesh Kumar's code does what you need.
    Check it out.

    Vijay

  10. #10
    Forum Contributor vijay2482's Avatar
    Join Date
    03-03-2009
    Location
    Paris,France
    MS-Off Ver
    Excel 2003
    Posts
    263

    Re: copy last column

    please attach the work book you are using.

  11. #11
    Registered User
    Join Date
    08-27-2009
    Location
    Gib
    MS-Off Ver
    Excel 2007
    Posts
    62

    Re: copy last column

    I found the problem, something was messed up with my data in my workbook and it couldn't identify the last column, now it work great with my code!
    thanks!

  12. #12
    Forum Contributor vijay2482's Avatar
    Join Date
    03-03-2009
    Location
    Paris,France
    MS-Off Ver
    Excel 2003
    Posts
    263

    Re: copy last column

    Arboze,

    Mark your post solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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