Copy data from different tabs and paste it in one sheet

Vimal_ku_mar

New Member
Joined
Jan 27, 2012
Messages
44
Hi All,

I am working on an excel file, which has over 30 tabs with data in it starting from line # 18 till line # 38 and from Column A to AD.

I want to copy the data from all the tabs and paste it into one tab in the same file (let's call it as Summary). In addition to this, I also want to copy the tab name in the AE column in the summary file.

Please help me with the Macro that can help me in doing this job.

thanks,
Vimal
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Please find the data that is placed in all the tabs. which i want to copy and paste in one tab.

NameDepartmentClassSection
ABCIT2nd Class3rd
CDEFinance1st Class2nd
EFDUS3rd Class1st
EGTUK4th Class4th

<tbody>
</tbody>
 
Last edited:
Upvote 0
In this example how do you want the information to be shown
ABC, IT, 2nd Class, 3rd

Or do you want other info as well?
 
Upvote 0
Try:
Code:
Sub CopyRange()
    Application.ScreenUpdating = False
    Dim ws As Worksheet, desWs As Worksheet, bottomA As Long
    Set desWs = Sheets("Summary")
    For Each ws In Sheets
        If ws.Name <> "Summary" Then
            bottomA = ws.Range("A" & ws.Rows.Count).End(xlUp).Row
            ws.Range("A18:AD38").Copy desWs.Cells(desWs.Rows.Count, "A").End(xlUp).Offset(1, 0)
            desWs.Cells(desWs.Cells(desWs.Rows.Count, "AE").End(xlUp).Row + 1, "AE").Resize(bottomA - 17) = ws.Name
        End If
    Next ws
End Sub
 
Upvote 0
I want whatever data is available in the tabs from the given criteria along with the tab name to be added to AE column please
 
Upvote 0
When i am running this macro i am getting the error as Visual Basic application error 400
 
Last edited:
Upvote 0
I think that it would be easier to help and test possible solutions if I could work with your actual file which includes any macros you are currently using. Perhaps you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Include a detailed explanation of what you would like to do using a few examples from your data and referring to specific cells, rows, columns and worksheets. If the workbook contains confidential information, you could replace it with generic data.
 
Upvote 0

Forum statistics

Threads
1,214,861
Messages
6,121,969
Members
449,059
Latest member
oculus

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