Combine data from 4 Sheets into one sheet

Brentsa

Board Regular
Joined
Oct 3, 2013
Messages
118
Office Version
  1. 365
Platform
  1. Windows
Good day,

I have 4 sheets in my workbook which represents the various departments. The headings are the same in all 4 sheets:
DateName of staffType of IncidentNegative/PositiveResult of IssueAction TakenComments

We want to create a master sheet where we combine the data of the 4 sheets into 1. This is in order to track a staff member within all 4 departments also to have the dates in order.

So I'm not sure if a =Filter function can work across 4 sheets. So any advise assistance will be greatly appreciated.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
So I have written this script to copy the data from sheets 2 to 5 to sheet named Master.

See if this works for you.
VBA Code:
Sub Copy_Sheets_To_Master()
'Modified  10/27/2020  5:40:43 AM  EDT
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Dim ans As Long

For i = 2 To 5
With Sheets(i)
    ans = .Cells(Rows.Count, "A").End(xlUp).Row
    Lastrow = Sheets("Master").Cells(Rows.Count, "A").End(xlUp).Row + 1
        .Cells(2, 1).Resize(ans, 7).Copy Sheets("Master").Cells(Lastrow, 1)
End With
Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Solution
I'm not sure what this means when forum says this post was marked. Are you saying my script worked
 
Upvote 0
Yes, your script works. Not exactly what i had in mind but it works so thanks a million
 
Upvote 0

Forum statistics

Threads
1,215,429
Messages
6,124,834
Members
449,192
Latest member
mcgeeaudrey

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