Results 1 to 6 of 6

Extract data from closed workbooks and copy into new workbook

Threaded View

philaugust2004 Extract data from closed... 04-13-2013, 12:11 PM
philaugust2004 Re: Extract data from closed... 04-14-2013, 12:12 PM
Saarang84 Re: Extract data from closed... 04-15-2013, 02:46 AM
philaugust2004 Re: Extract data from closed... 04-15-2013, 05:18 AM
Saarang84 Re: Extract data from closed... 04-15-2013, 06:06 AM
philaugust2004 Re: Extract data from closed... 04-15-2013, 07:45 AM
  1. #1
    Forum Contributor
    Join Date
    08-04-2004
    Location
    Amsterdam
    MS-Off Ver
    2016
    Posts
    186

    Extract data from closed workbooks and copy into new workbook

    First I will explain my problem.
    I have directories named 2008,2009,2010,2011,2012 and 2013.
    Within all directories are 2 large files (about 150mb to 220mb each) called Jumps and Flat. Each file has same number of columns with identical headings but varying number of rows
    Each has 2 sheets (the data sheet and a blank sheet). Data sheet has same name as workbook.

    I need to extract data based on values on one column only(always column m which is headed "Name").
    In sheet 2 I have a named range (A1:A40) which I enter the values I need to search for. This can be any amount of different text values from 2-40. Each value can appear multiple times (or not at all) in the lookup workbooks or only appear in some workbooks. I need to extract the entire row where the lookup data appears in column M and paste into a new workbook. It will need to be done in order so 2008-2013.

    Currently I open each book, enter the data in the named range area in sheet 2 and run a macro which filters the data sheet.
    It is ok but time consuming to open each file as it takes a while due to the huge size and if I have all files open then it becomes hard to manage.

    I need to
    1 have a master sheet into which I enter the values to search for.
    2 I choose whether to look in "Jumps" workbooks or "Flat" workbooks.
    2 The macro then goes to each workbook (Flat or Jumps for each directory) and extracts all rows where the data appears and pastes this into a 2nd sheet in my master. this will already have the headers. I don't really want to have to open each file.

    The macro I currently have is:
    Dim v As Variant
    Dim varCellContent As Range
    Dim ws As String
    
    On Error Resume Next
        Set varCellContent = Application.InputBox(Prompt:="Choose a sheet by clicking on any cell in it.", Type:=8)
        On Error GoTo 0
    
        If Not varCellContent Is Nothing Then
            ws = varCellContent.Parent.Name
                    Worksheets(ws).Activate
                    End If
     If ActiveSheet.FilterMode Then
        ActiveSheet.ShowAllData
      End If
    v = Application.Transpose(Range("MyList"))
        Worksheets(ws).Range("$A$1:$HO$50000").AutoFilter Field:=13, Criteria1:=v, Operator:=xlFilterValues
            
    End Sub

    Many many thanks to any help you can give
    I have Excel 2010
    Last edited by philaugust2004; 04-14-2013 at 12:17 PM. Reason: to put code tags in post

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