Find row with the same data like in another row
Here is one way:
Sub FindRowInOther()
Dim Y as double
Dim Y as double
Dim Found as integer
dim Dataarray(20,1) as variant
sheets("Lookfordata").select
for X=1 to 20
dataarray(x,1)=cells(activecell.row,x).value
next
sheets("lookinData").select
x=1
do while true
if cells(x,1).value=empty then exit do 'assumes nothing in column A
ends search
found=0
for Y=1 to 20
if cells(x,Y).value=dataarray(x,1) then
found=Found+1
end if
end for
if found=20 then
msgbox("Found it! on row " & x)
cells(x,1).select
Ans=1
exit do
end if
x=x+1
Loop
if Ans=0 then
msgbox("Could not find your data!")
end if
End sub
"Bartosz" wrote:
Hello All,
I try to learn VBA myself. But it stoped me:
Workbook A contain lot of rows. Workbook B contain one row which I need to
find in Worbook A. I try to find row in Workbook A which contain the same
data (First 20 columns contain data) like row 1 in Workbook B.
Thanks
|