Consolidate Data

ashani

Active Member
Joined
Mar 14, 2020
Messages
345
Office Version
  1. 365
Platform
  1. Windows
Hi,

I wonder if someone please could guide me. In my spreadsheet I have several worksheet, however I only want to consolidate data from Sheet, A, B, C & E into one master sheet. The columns are the same, all I want everytime I click on consolidate, the system should copy all the data from the said sheet into one and don't duplicate, so it may be first clear the master sheet then copy the whole lot. The row and column I want the data copy from each sheet is A4:I1000.

Please can someone help me with this.

Thank you
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hello Ashani,

Assuming that your source worksheets are named "A", "B", "C"...etc., the following code should work for you:-

VBA Code:
Option Explicit
Sub Test()

        Dim ar As Variant, i As Long, wsM As Worksheet
        ar = Array("A", "B", "C", "E")
        Set wsM = Sheets("Master")
       
Application.ScreenUpdating = False
       
        Sheet1.UsedRange.Offset(1).Clear
       
        For i = 0 To UBound(ar)
              Sheets(ar(i)).Range("A4:I1000").Copy wsM.Range("A" & Rows.Count).End(3)(2)
        Next i

Application.ScreenUpdating = True

End Sub

I'm also assuming that your Master sheet has headings in row1 with the transferred data to start in row2.

I hope that this helps.

Cheerio,
vcoolio.
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

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