search row

M

Marco

I desire seach all row in a range that have 2 value set with imputbox and
copy into an other sheet.
Is it possible?
ex
2 5 4 7 9
1 4 3 6 5
7 8 9 3 4
9 3 5 7 1

seach and copy 5 4
2 5 4 7 9
1 4 3 6 5

thx for help
 
Ó

Óã¸É

Sub yqr1()
Worksheets("sheet1").Activate
Set aaa = Range("a1").CurrentRegion
bbb = aaa.Rows.Count
ccc = aaa.Columns.Count
For i = 1 To bbb
Worksheets("sheet1").Activate
For j = 1 To ccc
If Cells(i, j) = "5" Then a = 1
If Cells(i, j) = "4" Then b = 1
Next j
If a = 1 And b = 1 Then
Cells(i, 1).EntireRow.Copy
Worksheets("sheet2").Activate
Cells(Range("a1").CurrentRegion.Rows.Count + 1, 1).EntireRow.Select
ActiveSheet.Paste
End If
a = 0
b = 0
Next i
End Sub
 
Top