+ Reply to Thread
Results 1 to 3 of 3

Selecting and Copying a Cell or a Range of Cells from One or More Files or Worksheets

  1. #1
    Registered User
    Join Date
    01-27-2008
    Posts
    2

    Red face Selecting and Copying a Cell or a Range of Cells from One or More Files or Worksheets

    Situation: I sent a protected excel file to over 250 persons. The file contains two or more cells where they will be inputting data in, like B1 and D1. The files (still the same file only with different data) will be returned to me by over 250 persons.

    Question: Is there a way I can list the files down into one spreadsheet automatically with a macro? If there is, how?

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Will the returned workbooks be saved into one directory?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    01-27-2008
    Posts
    2

    Reply on Situation:...

    It's going to be placed in the same folder.

    Here's an example of I meant to say:

    The "Consolidation_File_Grades.xls" file is supposed to contain the data from the individual files and/or worksheets. Yellow cell color refers to the data which was taken from individual files and/or worksheets.

    The "Grades_Adams&Santos.xls" and "Grades_Moreno&Toledo.xls" files are two sample files of the 250 persons when the give me back the template or form (still an excel file).

    Data from these two (or infinitely more files) will be taken at certain cells. In this scenario, they are B1 to B4 and D8. These two files and all files which will be placed in this same folder will have the same format and text, except that of the indicated cells (B1 to B4 and D8).

    The question is how do I go about this? Do I need to create a macro? ...Or is there a function in Excel that can do that for me?

    I saw a code which I think is very much related to this topic. I just don't know how to read code yet nor how to make some.

    I copied this from this website (forgive me for not mentioning the author). It shows partially how to do it. The problem is that this code only applies to a single file and it only lists the copied cells to one row:

    'The following will return the values on a sheet in a closed workbook and write them to the same range on the active worksheet. Place the code below into the standard module

    Sub test()
    GetValuesFromAClosedWorkbook "C:", "Book1.xls", _
    "Sheet1", "A1:K30"
    End Sub

    Sub GetValuesFromAClosedWorkbook(fPath As String, _
    fName As String, sName, cellRange As String)
    With ActiveSheet.Range(cellRange)
    .FormulaArray = "='" & fPath & "\[" & fName & "]" _
    & sName & "'!" & cellRange
    .Value = .Value
    End With
    End Sub

    Thanks in advance,
    Tyler
    Attached Files Attached Files
    Last edited by Tyler Peco; 01-27-2008 at 04:10 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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