+ Reply to Thread
Results 1 to 7 of 7

Macro to import workbook to sheet tab based on name

  1. #1
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,722

    Macro to import workbook to sheet tab based on name

    I have several workbooks that I wish to import and copy to the destination workbook. I have written a macro to do this, but want the macro amended so that each sheet imported is pasted on a seperate sheet based on the name of the workbook limited to the first 20 characters

    I have attached my source data (BR1 Stock Due.xls) as well as my destination workbook


    Your assistance in this regard is most appreciated
    Attached Files Attached Files
    Last edited by Howardc1001; 04-01-2020 at 01:12 AM.

  2. #2
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: Macro to import workbook to sheet tab based on name

    Hi
    given the data you get better results if you adapt your macro like this:
    Please Login or Register  to view this content.
    Cheers
    Erwin
    I started learning VBA because I was lazy ...
    Still developing.... being more lazy...

  3. #3
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,722

    Re: Macro to import workbook to sheet tab based on name

    Thanks for amending my code Erwin

    What I what looking that each workbook to be copied into a separate sheet based on the source workbook name 1st 20 characters only for eg if source workbook is BR1 South Stock sales Reporting for period ending 31/03/2020 then sheet to be created called BR1 South Stock Rep and the data from this work to be copied to this sheet etc


    Your assistance in this regard is most appreciated

  4. #4
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: Macro to import workbook to sheet tab based on name

    Hi please see following, you have to make a list of files, but this will only work if you rename your files accordingly...
    Why not export a list of files from Windows with the real names, adapt it to your needs and put this in your workbook?
    To do this: in the command screen of windows:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Cheers
    Erwin
    Attached Files Attached Files
    Last edited by Eastw00d; 04-01-2020 at 04:37 AM. Reason: minor update

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Macro to import workbook to sheet tab based on name

    Try
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,722

    Re: Macro to import workbook to sheet tab based on name

    Thanks for the help and your input

  7. #7
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,722

    Re: Macro to import workbook to sheet tab based on name

    Thanks for the help Jindon, code works perfectly

+ 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] VBA/Macro Save rows (based on criteria) as value to new sheet in closed workbook(s)...
    By blak9 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-02-2019, 07:37 AM
  2. Import sheet from a closed workbook
    By tejay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-14-2016, 12:12 PM
  3. Macro to build new sheet in workbook based upon contents of a different sheet in same book
    By IrishMist1748 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-09-2014, 06:44 PM
  4. macro for vlookup based on ID and Sheet name from other workbook
    By darkhangelsk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-12-2014, 12:37 PM
  5. Import sheet from external workbook
    By ElkySS in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-18-2013, 05:36 PM
  6. macro to copy rows to another sheet based on condition mentioned in another workbook
    By sona_tejas in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-07-2013, 06:23 AM
  7. File import - select file and import sheet(1) from closed workbook
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-22-2011, 03:15 AM

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