+ Reply to Thread
Results 1 to 10 of 10

VBA to import used range of specific columns to different columns

  1. #1
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    VBA to import used range of specific columns to different columns

    Hello All,
    Im looking for a way to import variable data from different columns in two different open workbooks to a master file. In the attached workbook I've given an example of the data in two different books on the Data1 and Data2 worksheets, and what the finished product should look like on the FinishedData sheet.
    The code I'm working with is this:

    Please Login or Register  to view this content.
    and this:

    Please Login or Register  to view this content.
    There are two different buttons to call each macro. Of course, the current code will copy ALL of the data, and I need it to only grab a specific set of columns, preferably without using the clipboard. In the actual master file, "Test" is the worksheet name the data is copied to.
    Any help would be greatly appreciated, Thanks!
    Attached Files Attached Files
    Last edited by Pierce Quality; 02-13-2014 at 01:29 PM.

  2. #2
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    Re: VBA to import used range of specific columns to different columns

    Bumping along.

  3. #3
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    Update

    I've since updated the code to this:
    Please Login or Register  to view this content.
    And this:

    Please Login or Register  to view this content.
    Which is on the right track but is only going to copy one cell in the column. What I am stuggling with is how to write the range method to copy the variable range of the data in each column.
    Any help would be greatly appreciated, thanks!

  4. #4
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    Re: VBA to import used range of specific columns to different columns

    Bumping along.

  5. #5
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: VBA to import used range of specific columns to different columns

    Hi,
    it's strange nobody answered for so long

    Apply such change to all of copy statements

    Please Login or Register  to view this content.
    If you are pleased with a member's answer then use the Star icon to rate it.

  6. #6
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    Re: VBA to import used range of specific columns to different columns

    Quote Originally Posted by buran View Post
    Hi,
    it's strange nobody answered for so long

    Apply such change to all of copy statements

    Please Login or Register  to view this content.
    Hello buran, thanks for the reply!

    That solves the range copy issue, thanks! However, when I initiate the second macro I get a run time error 438 (object does not support this property or method) when it tries to paste the second set of data into that same column. How can I get it to paste in the first open cell in that column?
    Thanks!

  7. #7
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: VBA to import used range of specific columns to different columns

    Can you post your new code. It looks like you have a syntax error

  8. #8
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    Re: VBA to import used range of specific columns to different columns

    Quote Originally Posted by buran View Post
    Can you post your new code. It looks like you have a syntax error
    Sure thing, here is the first one:

    Please Login or Register  to view this content.
    And the next:

    Please Login or Register  to view this content.
    Thanks!

  9. #9
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: VBA to import used range of specific columns to different columns

    I think it's because you are missing the continuation "_" after Copy

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    Re: VBA to import used range of specific columns to different columns

    Quote Originally Posted by buran View Post
    I think it's because you are missing the continuation "_" after Copy
    Aha! That did the trick!
    Thank you very much, marking this as solved!

+ 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. [SOLVED] Import specific columns past a certain row into another spreadsheet.
    By Nexion21 in forum Excel General
    Replies: 4
    Last Post: 08-10-2013, 08:49 PM
  2. How to import specific columns from excel file
    By Drehb4life in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-26-2013, 12:55 PM
  3. Macro to import data from specific columns form csv and rearrange
    By tonyrobbo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-21-2013, 02:01 PM
  4. vba only import columns from csv with specific text in row A
    By CuvelieY in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-17-2011, 09:41 AM
  5. import data to specific columns
    By marlea in forum Excel General
    Replies: 1
    Last Post: 08-11-2005, 10:05 PM

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