Copy rows from multiple sheets based on cell value on Summary sheet

Victor Moss

Board Regular
Joined
May 3, 2014
Messages
90
Hi guys,

I'd like to do a data validation across multiple worksheets, so on Sheet1 I have Data Validation listing data on a certain sheet. Because I cannot get the result for Data Validation across multiple sheets, I'm using VBA, the Macro needs to run through all sheets except Sheet1, and check each sheet if the Data Validation value exists in Column I of each sheet, if it does, copy the entire row to Sheet1 from row 3 and so forth until all rows have been copied. My code so far:

Application.ScreenUpdating = False

Dim ws As Worksheet
Dim v As Integer

For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Sheet1" Then
For v = 1 To 1000
If ws.Range("I" & v).Value = Sheets("Sheet1").Range("B1").Value Then
ws.Rows(v & ":" & v).Copy
Sheets("Sheet1").Range("A60000").End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues

End If
Next v
End If
Next ws

My problem is that it isn't looping through all sheets and copying all rows. Is there something I am missing? I also get a run-time 13 error, Type Mismatch on this row:

If ws.Range("I" & v).Value = Sheets("Sheet1").Range("B1").Value Then

If anyone can help please?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi,​
as looping cell by cell to copy row by row is the slowest way so according to Excel basics you should restart from using a filter …​
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,893
Members
449,097
Latest member
dbomb1414

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