+ Reply to Thread
Results 1 to 5 of 5

conditional copy data from multiple workbooks

Hybrid View

Brontosaurus conditional copy data from... 07-16-2011, 09:52 AM
mrice Re: conditional copy data... 07-16-2011, 10:35 AM
Brontosaurus Re: conditional copy data... 07-16-2011, 11:55 AM
mrice Re: conditional copy data... 07-16-2011, 12:11 PM
Brontosaurus Re: conditional copy data... 07-16-2011, 12:20 PM
  1. #1
    Forum Contributor
    Join Date
    01-23-2010
    Location
    Suffolk, England
    MS-Off Ver
    Office 365
    Posts
    271

    conditional copy data from multiple workbooks

    i want to copy the first 8 columns of data from every row in specified sheets in several workbooks if the column a value is "1" and paste it all into the first 8 columns of a new worksheet in the active workbook.

    Can someone help with this please?

    I've checked the forum and googled it but there are so many references I'm completely confused.

    Any help would be appreciated and example data attached

    Thanks

    Louise
    Attached Files Attached Files
    Last edited by Brontosaurus; 07-16-2011 at 12:21 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: conditional copy data from multiple workbooks

    Try the attached macro workbook. You will need to set up the configuration as in the example.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    01-23-2010
    Location
    Suffolk, England
    MS-Off Ver
    Office 365
    Posts
    271

    Re: conditional copy data from multiple workbooks

    Thank you, this works perfectly.

    Could you let me know how to modify it to put the pasted data into a specified, existing worksheet inside the active workbook?

    I really appreciate it

    Louise

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: conditional copy data from multiple workbooks

    OK

    Change the code in module1 (alt F11) to

    Sub Test()
    For N = 2 To ThisWorkbook.Sheets("Config").Cells(Rows.Count, 1).End(xlUp).Row
        Workbooks.Open Filename:=ThisWorkbook.Sheets("Config").Cells(N, 1), ReadOnly:=True
        ActiveWorkbook.Sheets(ThisWorkbook.Sheets("Config").Cells(N, 2).Value).Activate
        For M = 2 To Cells(Rows.Count, 1).End(xlUp).Row
            If Cells(M, 1) = 1 Then
                Range(Cells(M, 1), Cells(M, 8)).Copy
                ThisWorkbook.Sheets("Target").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial (xlPasteValues)
            End If
        Next M
        ActiveWorkbook.Saved = True
        ActiveWorkbook.Close
    Next N
    End Sub
    I've assumed that your specified sheet is called "Target".

  5. #5
    Forum Contributor
    Join Date
    01-23-2010
    Location
    Suffolk, England
    MS-Off Ver
    Office 365
    Posts
    271

    Re: conditional copy data from multiple workbooks

    Absolutely brilliant, thank you very much!

    Louise

+ 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