Copying all the data from first column from 5 tabs and pasting it all in one colmun

Imran Azam

Board Regular
Joined
Mar 15, 2011
Messages
103
Hi Guys

how is everyone

I have an excel task where I need to automate a task which involves copying data from the first columns of 4 tabs ( column A:A from sheet1,sheet2,sheet3 and sheet4) and pasting all this data in to the column A on sheet5

Stacked one after another,

is this possible, if so how can I do this?

thank you for any help
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Code:
Dim Ws As Worksheet
For Each Ws In Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4"))
    Ws.Range(Ws.[A1], Ws.Cells(Rows.Count, 1).End(xlUp)).Copy _
    Sheets("Sheet5").Cells(Rows.Count, 1).End(xlUp)(2)
Next
 
Upvote 0
Code:
Sub MyMacro()
Dim Ws As Worksheet
For Each Ws In Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4"))
    Ws.Range(Ws.[A1], Ws.Cells(Rows.Count, 1).End(xlUp)).Copy _
    Sheets("Sheet5").Cells(Rows.Count, 1).End(xlUp)(2)
Next
End Sub

1. Copy the above macro.
2. Open the workbook in which you want to add the code.
3. Hold the Alt key, and press the F11 key, to open the Visual Basic Editor.
4. Choose Insert. | Module.
5. Where the cursor is flashing, choose Edit. | Paste.
6. Run the macro.
 
Upvote 0
thank you , this almost works , 2 issues , 1) I don't one cell a:1 to be copied ( that has the title which I don't need) 2) every time I run the macro I want the pervious data on sheet deleted and the new data to be pasted, can this be done?
 
Upvote 0
Code:
Sub MyMacro()
Dim Ws As Worksheet, rng As Range
For Each Ws In Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4"))
    Set rng = Ws.Range(Ws.[A2], Ws.Cells(Rows.Count, 1).End(xlUp))
    rng.Copy Sheets("Sheet5").Cells(Rows.Count, 1).End(xlUp)(2)
    rng.ClearContents
Next
End Sub

Or perhaps you mean this :
Code:
Sub MyMacro()
Dim Ws As Worksheet
Sheets("Sheet5").Range([A2], Cells(Rows.Count, 1)).ClearContents
For Each Ws In Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4"))
    Ws.Range(Ws.[A2], Ws.Cells(Rows.Count, 1).End(xlUp)).Copy _
    Sheets("Sheet5").Cells(Rows.Count, 1).End(xlUp)(2)
Next
End Sub
 
Last edited:
Upvote 0
thank you so much for your help , I think I might not have been fully clear its very good what you given me but its not fully working, sheet 5 when the macro is run needs to take from column all colon A ( excluding the A1 as that is the title) sheet1 -sheet4 and paste it in column Asheet5 stacked one on top of the other, each time the macro is run sheet 5 needs to be deleted ( incase there is new data in the other sheet ) and the new data needs to pasted . this almost works , do I make any sense?
 
Upvote 0
this clears the sheets1-sheet4, I need it to clear sheet5 first and then paste the data I don't want sheet1 -4 cleared, thank uyou for your help almost there :)
 
Upvote 0
thank you so much for your help , I think I might not have been fully clear its very good what you given me but its not fully working, sheet 5 when the macro is run needs to take from column all colon A ( excluding the A1 as that is the title) sheet1 -sheet4 and paste it in column Asheet5 stacked one on top of the other, each time the macro is run sheet 5 needs to be deleted ( incase there is new data in the other sheet ) and the new data needs to pasted . this almost works , do I make any sense?

Have you tried the second macro in post #6 ?
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top