Copy Data from tow sheets and pasting in third sheet

ajita

New member
Joined
Feb 12, 2014
Messages
4
Reaction score
0
Points
0
I have a excel with 3 sheets .
My requirement is to pull data from sheet1 ,sheet2 and put it into sheet3.
There would be two headings in sheet 3 1)Active which would pull records from sheet1 and put it under it.
2) Inactive which would pull records from sheet2 and place it under Inactive cell
First it would populate from sheet1 to sheet3 under Active cell and then it should pull data from sheet2 and put in under inactive cell.

Please advise as I am new to VBA.
Thanks
 
can you upload a sample workbook of what you expect this to look like, and to show the data you have.

For example, is data only in column A on both sheet1 and sheet2?
 
Please find my sample worksheet attached.Appreciate your help and would be thankful in giving me directions.
 

Attachments

  • Requirement.xlsx
    9 KB · Views: 14
depending on how much data you have or if you end up with more columns you may need something different.

But this should work with the sample you provided.

Code:
Sub simi_copy()


Worksheets("Active").Range(Worksheets("Active").Cells(2, 1), Worksheets("Active").Cells(Worksheets("Active").Cells(Worksheets("Active").Rows.Count, "A").End(xlUp).Row, 3)).Copy _
    Destination:=Worksheets("Final").Cells(Worksheets("Final").Cells(Worksheets("Final").Rows.Count, "A").End(xlUp).Row + 1, 1)
Worksheets("Inactive").Range(Worksheets("Inactive").Cells(2, 1), Worksheets("Inactive").Cells(Worksheets("Inactive").Cells(Worksheets("Inactive").Rows.Count, "A").End(xlUp).Row, 3)).Copy _
    Destination:=Worksheets("Final").Cells(Worksheets("Final").Cells(Worksheets("Final").Rows.Count, "A").End(xlUp).Row + 1, 1)


End Sub
 
will this automatically copy the all data retrieved in both sheets and paste it on the third sheet?
First the data from sheet 1 and then from sheet 2?

Please give your valuable inputs and would really helpful for a novice like me
 
The way this is setup, it will copy all the data from cell "A2" to cell "C(bottom row with data)" from the "Active" sheet, and paste it to sheet3 "Final".
Then it will copy all the data from "Inactive" in the same way and paste to "Final"

If you run this macro more than once, it will append the data to the bottom of sheet3, So in your example book, you only had 1 record on each of the first 2 sheets.
so sheet3 would end up with 2 records on it. if you run the macro again sheet3 would have 4 records on it.

It is simple and effective.
 
Thank you so much Simi.

Another questions can I copy some of the columns from Inactive sheet and paste it under some columns in Final sheet.

This I want after I copy all data from active to final sheet .
I know I am asking too much but as I am noviec I would need your advice.
 
I'm not sure what you are asking now.

The code above copies all data from active to final, then all data from inactive to final.
 
Back
Top