+ Reply to Thread
Results 1 to 5 of 5

Consolidate lots of files

  1. #1
    Registered User
    Join Date
    06-02-2021
    Location
    Mexico City
    MS-Off Ver
    Office 2019
    Posts
    2

    Consolidate lots of files

    Hello everyone:

    Am brand new in vba and Macros with Excel, and I've been working to improve some manual tasks performed every Month…

    The main issue is that monthly are generated between 100 and 3000 excel files, all with the same estructure and characteristics (the data is in the same cells and range of cells), I have been able to reach the files using the ThisWorkbook.path & "\reports\" method but I don't know how to get the data stored in the sheet "REPORT" from the 3 visible sheets and 7 hidden sheets.

    The data that I need to get is in Cells, A8 (but only the last number not the text in the beginning), A11 and in the range (that can change from 1 row to 300 rows, only need the rows with data), B30 (Description), C30 (Quantity), and D30 (Units).

    The final result have to be like this


    result.png
    Last edited by Barucomx; 06-02-2021 at 04:46 PM. Reason: Format of the result

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Consolidate lots of files

    Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Registered User
    Join Date
    06-02-2021
    Location
    Mexico City
    MS-Off Ver
    Office 2019
    Posts
    2

    Red face Re: Consolidate lots of files

    Terrific!

    Attached is both a zip file with the source files and the desired result thank you so much!
    Attached Files Attached Files

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Consolidate lots of files

    Possibly...
    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Try this !


    According to your attachment a VBA demonstration for starters (v2) :

    PHP Code: 
    Sub Demo1()
        
    Dim P$, F$, V(), W(), L&, R&, C%
            
    ThisWorkbook.Path "\cotizaciones\"
            F = Dir$(P & "
    *.xlsx"):  If F = "" Then Beep: Exit Sub
            [A1].CurrentRegion.Offset(1).Clear
            ReDim V(1 To Rows.Count - 1, 1 To 5)
        With CreateObject("
    ADODB.Connection")
            Do
                   .Open "
    Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=""Excel 12.0;HDR=No"";Data Source=" & P & F
                    W = .Execute("
    [COTIZACION$A8:A21]").GetRows
                    V(R + 1, 1) = Mid(W(0, 0), InStrRev(W(0, 0), " ") + 1):  V(R + 1, 2) = W(0, 13)
                    W = .Execute("
    [COTIZACION$B30:D48]").GetRows:  L = 0
                   .Close
                Do
                    R = R + 1:  For C = 3 To 5:  V(R, C) = W(C - 3, L):  Next:   L = L + 1
                Loop Until IsNull(W(0, L))
                       F = Dir$
            Loop Until F = ""
        End With
            [A2].Resize(R, 5).Value2 = V
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 07-15-2021 at 09:15 AM.

+ 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] VB Code to bring data from lots of files in same folder
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-03-2019, 12:52 AM
  2. [SOLVED] Force Relative File Links/Pull In Lots of Files?
    By schalliol in forum Excel General
    Replies: 5
    Last Post: 10-29-2014, 03:11 AM
  3. Replies: 2
    Last Post: 10-13-2014, 01:02 PM
  4. closing lots of excel files
    By ammartino44 in forum Excel General
    Replies: 2
    Last Post: 02-24-2014, 09:30 PM
  5. Change Page size of lots of files
    By rizmomin in forum Word Programming / VBA / Macros
    Replies: 0
    Last Post: 10-29-2010, 11:28 AM
  6. Transfering files from lots of files to one single Exel master file.
    By yjacob in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 07-01-2009, 11:37 AM
  7. [SOLVED] Importing lots of CSV files into an XLS file as different workshee
    By rmellison in forum Excel General
    Replies: 4
    Last Post: 01-05-2006, 07:30 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