PDA

View Full Version : Macro to combine output of two sheet into one



cruise
05-16-2012, 08:43 PM
:help I have two excel sheet in D:/sheet1.xls, D:/sheet2.xls. I want to copy the data from second row of sheet 1 and 2 to a new sheet (D:/sheet3.xls) to the last row where data is empty
if sheet 3 contain 200 records, then the output of sheet 1 start from 201 records upto last, followed by sheet2 data.

I am new, Can anybody help me in writing the macro.

BrianMH
05-17-2012, 12:27 AM
When you say sheets I assume you mean the first sheet in each workbook and you want 3 separate workbooks correct?

Where do you want to run this code from? A separate workbook or the first workbook?

cruise
05-17-2012, 01:32 AM
thanks for your response
Yes sheet 3 is the main sheet, where I want to run macro so that data of sheet 1 and sheet2 are copied from second rows and paste into sheet3
I am able to work in the same sheet but not different one
Sub pp()
Dim ws As Worksheet

Application.ScreenUpdating = False
Sheets("Sheet4").Activate

For Each ws In Worksheets
If ws.Name <> "sheet4" Then
selection.Copy
ActiveSheet.Paste Range("A65536").End(xlUp).Offset(1, 0)
End If
Next ws
End Sub