+ Reply to Thread
Results 1 to 3 of 3

Searching other files to import to specified cells in a master file

  1. #1
    Registered User
    Join Date
    09-16-2008
    Location
    Madrid, Spain
    Posts
    46

    Searching other files to import to specified cells in a master file

    I have found a large part of my solution from this thread:
    FROM HERE

    Basically, I want to search all the files in a specific folder and put different cells into a new line on a master excel. I have attached a picture so you can see what I mean more clearly.

    I have taken the macro from the above thread and modified to suit my needs. Now I just need to change a few things.

    Here is the code:
    Sub List()
    Dim z As Long, e As Long
    Dim f As String
    Cells(1, 1) = "=cell(""filename"")"
    Cells(1, 2) = "=left(A1,find(""["",A1)-1)"
    e = 2
    Cells(2, 1).Select
    f = Dir(Cells(1, 2) & "*.xls")
    Do While Len(f) > 0
    ActiveCell.Formula = f
    ActiveCell.Offset(1, 0).Select
    f = Dir()
    Loop
    z = Cells(Rows.Count, 1).End(xlUp).Row
    For e = 2 To z
    MsgBox Cells(e, 1)
    Cells(1, 3) = "='" & Cells(1, 2) & "[" & Cells(e, 1) & "]Sheet1'!E76"
    Cells(e, 2) = Cells(1, 3)
    Next e
    MsgBox "collating is complete."
    End Sub




    So this macro takes all the files in the folder it is in and puts the information in cell E76 to Column B.

    I want to to extend this macro a bit more and take the information from K40 to COLUMN A, G40 to Column B, E51 to Column C and so on for about 20 different cells.

    Also, I want them to start from ROW2 on, so that I can have titles at the top (if possible)

    Can I also get rid of the printing of the filenames in Column A ?



    Thank you so much for all your help and advice.
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    764

    modified macro

    HI
    I have modified the macro to pull value from 5 cells. you can extend it to any number (upto 99 in this macro). add cell references in quotes separated by comma.
    Ravi
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    09-16-2008
    Location
    Madrid, Spain
    Posts
    46
    thank you very much!!!

+ 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. How Can The Macro Rename Files When The Original File Name Changes Everday
    By np123345 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-01-2008, 06:59 PM
  2. Use one file to accumulate cells on a second file(closed).
    By nousibona in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-23-2008, 12:36 AM
  3. Replies: 20
    Last Post: 06-09-2008, 04:18 PM
  4. Problem Linking Cells in Different Workbooks
    By jeffc4442 in forum Excel General
    Replies: 7
    Last Post: 02-23-2007, 11:01 AM
  5. Import Macro trying to gain acces to file that doesn't exist.
    By Jen_DPS in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-20-2006, 12:35 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