Copy data from multiple sheets into master sheet if column A value is "REQUESTED"

surkdidat

Well-known Member
Joined
Oct 1, 2011
Messages
594
Office Version
  1. 365
Please can someone help! I need a formula which will run across multiple tabs (10 in total - each with a different persons name on) to copy into the "COMBINED" tab if column A on an agents worksheet is "REQUESTED". So if in Abbies worksheet A2 is "REQUESTED" then I want it to copy that line to the master tab, if A3 states "ON HOLD" it will skip this line. A3 contains "REQUESTED" so then I want it to copy this line. I then need this to do the same for all sheets. I don't want any blank lines on the "COMBINED" tab.

Many thanks
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
A couple question here. When you say:
"multiple tabs (10 in total -"

Do you mean all sheets in your workbook except for sheet named:"COMBINED"

So copy from all sheets in this workbook to sheet named "COMBINED"

Is this correct?

If this is not correct then you need to say sheets 2 to 11 or sheet 12 to 22

Sheets are numbered from left to right as to how they are shown on tab bar

Sheet 1 is in far left position and sheet 2 is next sheet to right.

If you would answer these questions we may be able to help you.

But you said:"I need a formula which will...."

I do not believe this can be done with a formula.

I believe you would need a Vba script.
 
Upvote 0
Hi there
Yes, the master sheet is called "Combined", This is the first sheet in my workbook. The next ten sheets are individual agents names, i.e. "Abbie", "Beth", "Charlotte" etc.,
Apologies, typ (of sorts!) I know its VBA, its a Friday and put formula instead!!!:laugh:
 
Upvote 0
Thy this:

Be sure sheet is named: "Combined"
And we are looking for "REQUESTED"
Code:
Sub Copy_Rows()
'Modified 1-12-18 5:45 AM EST
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
    For i = 2 To 11
        Lastrow = Sheets("Combined").Cells(Rows.Count, "A").End(xlUp).Row + 1
        Lastrowa = Sheets(i).Cells(Rows.Count, "A").End(xlUp).Row
    
        With Sheets(i).Range("A1:A" & Lastrowa)
            .AutoFilter 1, "REQUESTED"
            .Offset(1).EntireRow.Copy Sheets("Combined").Cells(Lastrow, 1)
            .AutoFilter
        End With
    
    Next
Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0
Thank you for this. I am logically working out the For 1=2 to 11 is the number of sheets in it. Is there anyway of making this value "x" so if new sheets are added at any point then it saves a code change?

Thy this:

Be sure sheet is named: "Combined"
And we are looking for "REQUESTED"
Code:
Sub Copy_Rows()
'Modified 1-12-18 5:45 AM EST
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
    For i = 2 To 11
        Lastrow = Sheets("Combined").Cells(Rows.Count, "A").End(xlUp).Row + 1
        Lastrowa = Sheets(i).Cells(Rows.Count, "A").End(xlUp).Row
    
        With Sheets(i).Range("A1:A" & Lastrowa)
            .AutoFilter 1, "REQUESTED"
            .Offset(1).EntireRow.Copy Sheets("Combined").Cells(Lastrow, 1)
            .AutoFilter
        End With
    
    Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Try this:

It looks in all sheets from sheet 2 to last sheet in workbook.
Will that work for you?

Code:
Sub Copy_Rows()
'Modified 1-12-18 6:15 AM EST
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
    For i = 2 To Sheets.Count
        Lastrow = Sheets("Combined").Cells(Rows.Count, "A").End(xlUp).Row + 1
        Lastrowa = Sheets(i).Cells(Rows.Count, "A").End(xlUp).Row
    
        With Sheets(i).Range("A1:A" & Lastrowa)
            .AutoFilter 1, "REQUESTED"
            .Offset(1).EntireRow.Copy Sheets("Combined").Cells(Lastrow, 1)
            .AutoFilter
        End With
    
    Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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