• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Multi column copying from multiple worksheets - code changes

Hi All,

I am using the following macro to copy each column of data from each worksheet in the workbook starting at column D into a newly created summary worksheet

Can you please help me to tweak this so this copy:

- same column from all worksheets in the workbook and stack these beside each other so column D from sheet1 should be pasted beside column D from Sheet2
- column E from sheet 1 is pasted beside column E from sheet 2 so on so forth



Code:
Sub Create_Summary()
  Dim Col As Range
  Dim n As Integer
  Dim sh As Worksheet
 
  Application.DisplayAlerts = False
  On Error Resume Next
  Sheets("Summary").Delete
  Application.DisplayAlerts = True
  n = Application.Worksheets.Count
  Sheets.Add.Name = "Summary"
  Sheets("Summary").Move after:=Worksheets(Worksheets.Count)
 
  For Each sh In ActiveWorkbook.Worksheets
  If sh.Name <> "Summary" Then
  Set Col = Sheets("Summary").Cells(5, Columns.Count).End(xlToLeft)
  sh.Range("D:D").Copy Destination:=Sheets("Summary").Range(Col.Address).Offset(-4, 1)
  End If
  Next sh
 
  'Range("A:B").Insert Shift:=xlToRight
'Sheets(n).Select
'Range("F:F").Copy Destination:=Sheets("Summary").Range("A:A")
 
 
End Sub
 
Back
Top