+ Reply to Thread
Results 1 to 3 of 3

Macro to copy specific columns from Multiple worksheets

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-28-2013
    Location
    Miami, United States
    MS-Off Ver
    Excel 365 (Newest version)
    Posts
    259

    Macro to copy specific columns from Multiple worksheets

    Anyone knows a macro that can copy specific columns from multiple worksheets and paste it into a summary sheet?. I am working with a large file and I only one specific columns from the different worksheets.
    ]
    eg:

    I would like for all values under the header name "Accuracy" to pasted in the summary sheet under the headeer name "accuracy" etc.


    Can this be done.

    Can anyone help me with this.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to copy specific columns from Multiple worksheets

    Maybe:

    Sub Shellybellyz()
    Dim ws As Worksheet
    Dim x As Long
    Dim y As Range
    Dim z As Long
    With Sheets("Summary Sheet")
        Set y = .Rows(1).Find("Accuracy", LookIn:=xlValues, Lookat:=xlWhole)
            If Not y Is Nothing Then z = y.Column
            Set y = Nothing
    End With
    For Each ws In ActiveWorkbook.Worksheets
    If ws.Name <> "Summary Sheet" Then
    ws.Activate
        Set y = Rows(1).Find("Accuracy", LookIn:=xlValues, Lookat:=xlWhole)
            If Not y Is Nothing Then
                x = Cells(Rows.Count, ActiveCell.Column).End(3).Row
            Range(Cells(2, ActiveCell.Column), Cells(x, ActiveCell.Column)).Copy Sheets("Summary Sheet").Cells(Rows.Count, z).End(3)(2)
            End If
            Set y = Nothing
    End If
    Next ws
    End Sub

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Macro to copy specific columns from Multiple worksheets

    Another:

    Sub RunMe()
    Dim wsSum As Worksheet: Set wsSum = Sheets("Summary")
    Dim ws As Worksheet
    Dim rFind As Range, rAcc As Range
    
    'Pay attention to capitalization!!!!!
    
    Set rAcc = wsSum.Range(wsSum.Cells(1, 1), wsSum.Cells(1, Columns.Count)).Find("accuracy", , xlValues, xlWhole)
    
    If rAcc Is Nothing Then
        MsgBox ("Could not identify accuracy column in summary sheet")
        Exit Sub
    End If
    
    For Each ws In Worksheets
        If ws.Name <> wsSum.Name Then
            Set rFind = ws.Range(ws.Cells(1, 1), ws.Cells(1, Columns.Count)).Find("Accuracy", , xlValues, xlWhole)
            If Not rFind Is Nothing Then
                rFind.Offset(1).Resize(ws.Cells(Rows.Count, rFind.Column).End(xlUp).Row, 1).Copy wsSum.Cells(Rows.Count, rAcc.Column).End(xlUp).Offset(1, 0)
            End If
        End If
    Next ws
                
    End Sub

+ 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. Replies: 2
    Last Post: 10-14-2014, 06:49 AM
  2. [SOLVED] Macro to copy specific worksheets into a new workbook
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-15-2013, 10:28 AM
  3. Replies: 8
    Last Post: 04-04-2013, 08:02 PM
  4. [SOLVED] Macro code to Copy specific rows into specific columns
    By macrofan2012 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-11-2012, 11:24 AM
  5. Macro to copy specific data to specific columns from a pivot table
    By Raju Radhakrishnan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-09-2012, 07:24 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