# Output rows in array

#### cortexnotion

##### Board Regular
Hi All

Could you help me finish the below? I am putting my very large data range into an array and looking to find matching rows and copy to the next sheet. Is it better to put the results into an output array and output at once or individually?

Any help appreciated.

VBA Code:
``````Sub vbamatch()

Dim InAry As Variant, LR1 As Long, LW1 As Long, a As Long

LR1 = ThisWorkbook.Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
InAry = ThisWorkbook.Sheets("Sheet1").Range("A2:O" & LR1).Value
ColorAry = Array("Red","Blue","Yellow","Green","Brown","Black")
LW1 = Application.Evaluate("INT((TODAY()-1)/7)*7+1")

For a = 1 To LR1
If InAry(a, 1) = LW1 & InAry(a, 5) = ColorAry(0) Then 'copy matching row to Sheet2 Range A2:O2
If InAry(a, 1) = LW1 & InAry(a, 5) = ColorAry(1) Then 'copy matching row to Sheet2 Range A3:O3
If InAry(a, 1) = LW1 & InAry(a, 5) = ColorAry(2) Then 'copy matching row to Sheet2 Range A4:O4
If InAry(a, 1) = LW1 & InAry(a, 5) = ColorAry(3) Then 'copy matching row to Sheet2 Range A5:O5
If InAry(a, 1) = LW1 & InAry(a, 5) = ColorAry(4) Then 'copy matching row to Sheet2 Range A6:O6
If InAry(a, 1) = LW1 & InAry(a, 5) = ColorAry(5) Then 'copy matching row to Sheet2 Range A7:O7
Next a
End Sub``````

#### Fluff

##### MrExcel MVP, Moderator
Glad to help & thanks for the feedback.

### Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Replies
3
Views
79
Replies
43
Views
982
Replies
0
Views
88
Replies
0
Views
103
Replies
2
Views
127

1,126,904
Messages
5,621,571
Members
415,847
Latest member
nigeywigey

### 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?

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