+ Reply to Thread
Results 1 to 5 of 5

Last Used Column in Loop Data Copy

  1. #1
    Registered User
    Join Date
    05-23-2011
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    79

    Exclamation Last Used Column in Loop Data Copy

    Hello,

    Can someone please help me adjust the following code to pull data from the Last Used Column in the source workbooks, thus replacing the "B" column designation? I do not want the code to require adjusting the column value, and instead, simply search for the last column with data on the source workbook to copy to the destination workbook.

    Thanks

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Last Used Column in Loop Data Copy

    Hello gsurge,

    Here is the corrected macro...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    05-23-2011
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: Last Used Column in Loop Data Copy

    Thank you so much Leith!

    Just so I can understand the added code better, can you briefly explain the syntax you entered to determine LastCol?

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Last Used Column in Loop Data Copy

    Hello gsurge,

    The code used to find the last column searches the worksheet cells column by column starting with the last column and moving left until it finds a cell in a column or it returns back to cell "A1". The "*" is a wildcard meaning any value in the cell.

    By checking if the result is "Nothing", the decision is made to either extract the column of the last cell or skip to the next workbook. If the resulting Range object isn't check to be "Nothing", a error will occur.

  5. #5
    Registered User
    Join Date
    05-23-2011
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    79

    [SOLVED] Last Used Column in Loop Data Copy

    thank you so much for the help

+ 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