+ Reply to Thread
Results 1 to 9 of 9

Import selected columns

  1. #1
    Forum Contributor
    Join Date
    11-21-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    190

    Import selected columns

    Hi,
    I want to import one worksheet from different workbooks to Master workbook.
    In the source workbook, I need to import only ' Code' sheet and in this code sheet , I need only 4 columns(A, E, F, and I ) to import.
    I also need cell C3and E3 in source worksheet to master workbook

    I want to import like 'Code(1), Code(2), Code(3),, and so on. I don't want to import whole thing in the one sheet in the master workbook.

    IN the master workbook, the header is on A3, so starting row will be row 4 in master workbook.

    Codes below is for 'stacked' style, I guess.
    Could anyone help me to import?

    Thank you!
    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Import selected columns

    Hi,

    I'm working on some code for you, but just a few questions to clarify...

    In the *Master* workbook, must the data collected from the source files be appended below the existing data, or must it replace it? IOW, if I import the data from source file 1 into master, then close file 1 and open source file 2, must the data of source file 2 be pasted in the appropriate columns BELOW source file 1's data, or must it be pasted onto a second sheet in Master...and so forth until all source files are imported?

    Secondly, I can understand collecting the data from source files from columns(A, E, F, and I) and from rows 4 to the end of each column, but where must the two pieces of data from cells C3 and E3 go? Maybe E3 replaces the heading E3 in the Master, but where must C3 go since we are not importing column C data?

    TX
    Regards,
    Rudi

  3. #3
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Import selected columns

    Hi,

    Here is some code based on what I think you might need. It appends the data from the source files below the last data in each of the columns in the first sheet of the *Master* file. Place the code below into a module in the Master file and run...

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    11-21-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: Import selected columns

    must it be pasted onto a second sheet in Master...and so forth until all source files are imported?
    Yes, this is what I want.
    where must the two pieces of data from cells C3 and E3 go?
    C3 is ID and E3 is the name, so I want C3 goes to A1 and E3 goes to B1 in each imported sheet in Master workbook.

    Thank you so much for your time.

  5. #5
    Forum Contributor
    Join Date
    11-21-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: Import selected columns

    I tried this but how I can import each sheet' code ' to each sheet in Master?
    Thanks

  6. #6
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Import selected columns

    Hi,

    If you want each Code sheet for the file to be added to a separate sheet in Master, the macro can add a sheet each time automatically for the file it is processing. I'll modify the macro to add a sheet for each Code sheet it processes...and update the C3 and E3 positions.

  7. #7
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Import selected columns

    Try this code...

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    11-21-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: Import selected columns

    Thank you very much!
    I want to ask one more thing , if you don't mind.
    Importing was great except column I in source workbook.
    Column I is for 'Work hours' and this column got ' #Value!' error in the 'Code' sheet in Master workbook.
    How can I fix this column I?
    Thanks

  9. #9
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Import selected columns

    It's probably due to being a calculated value.
    The following is untested air code, but try the following fix:

    Replace this line in the macro:
    Please Login or Register  to view this content.
    With these two new lines:
    Please Login or Register  to view this content.

+ 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. import only selected columns from different workbooks to master workbook
    By Goodstart14 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-15-2014, 11:51 AM
  2. [SOLVED] Merging selected sheets with selected columns into another sheet
    By harry_1805 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2013, 01:51 PM
  3. [SOLVED] Import user selected columns from a text file
    By aarho in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-11-2012, 08:28 PM
  4. [SOLVED] How to Import Selected Data
    By roy_ware in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-26-2005, 03:05 AM
  5. Import selected data
    By J in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-14-2005, 02:06 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