+ Reply to Thread
Results 1 to 7 of 7

Macro to extract the first WS from 5 WB

  1. #1
    Registered User
    Join Date
    05-04-2016
    Location
    Scotland
    MS-Off Ver
    2010
    Posts
    4

    Macro to extract the first WS from 5 WB

    Hi There,

    Really hope you can help,

    I have been asked to look into making a master spread sheet which will contain the first Work Sheet from 5 different Workbooks.
    The 5 workbooks are all laid out with the same columns but have a different number of rows which will fluctuate through out the month.

    The master spread sheet should have an extra column (A) that states the source name of the workbook it came from.

    I am completely new to Macros and came across this site by Googleing yesterday.

    Doug

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro to extract the first WS from 5 WB

    Hi and welcome to the forum.

    If you upload one of the 5 daughter workbooks (anonymise it ff necessary) , and tell us what the names of the other 4 are I'll put together a simple macro for you.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    05-04-2016
    Location
    Scotland
    MS-Off Ver
    2010
    Posts
    4

    Re: Macro to extract the first WS from 5 WB

    Hi Richard

    Basically the five sheets are price catalogues from our main suppliers.

    I have hopefully managed to attach an extract of one of the daughter workbooks. I have changed names and prices.
    Attached Files Attached Files

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro to extract the first WS from 5 WB

    Hi,

    See attached

    Enter the names of your catalogues in A4:A8 of the Variables sheet and the folder path where the catalogue files are located in C4 then run the macro with the blue button on the Summary sheet
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-04-2016
    Location
    Scotland
    MS-Off Ver
    2010
    Posts
    4

    Re: Macro to extract the first WS from 5 WB

    Hi Richard,

    Thanks for your help, When I try and use the macro it stopping on this line

    Workbooks.Open Filename:=Range("Path") & "\" & Range("catalogues").Cells(c, 1)

    All I did was save the file down and put in the new path "S:\accountants\Doug\Month End" which contains the file Catering.

    The Run time error '1004':

    Microsoft Excel cannot access the file 'S:\accountants\Doug\Month End\Catering.'

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro to extract the first WS from 5 WB

    Hi,

    Try putting a "\" on the end of the path.

    S:\accountants\Doug\Month End\

  7. #7
    Registered User
    Join Date
    05-04-2016
    Location
    Scotland
    MS-Off Ver
    2010
    Posts
    4

    Re: Macro to extract the first WS from 5 WB

    Thank you Richard,

    I worked out I needed & ".xlsx" at the end of the line.

    Workbooks.Open Filename:=Range("Path") & "\" & Range("catalogues").Cells(c, 1) & ".xlsx"

+ 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. Macro to Extract Information
    By brazilianch in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-08-2015, 09:34 PM
  2. [SOLVED] Macro to extract data from a URL
    By Flabbergaster in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-13-2014, 07:13 PM
  3. Replies: 0
    Last Post: 01-03-2014, 10:04 AM
  4. [SOLVED] VBA Extract Macro
    By hobbiton73 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-17-2013, 09:42 AM
  5. [SOLVED] Pausing A Macro (allow user to extract data) aAnd Resume Macro
    By jbumps in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2013, 01:59 PM
  6. Macro to extract few datas from pdf
    By Raju Radhakrishnan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-13-2012, 01:25 PM
  7. Macro to extract data
    By Bill A in forum Excel General
    Replies: 3
    Last Post: 02-15-2006, 08:35 AM

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