View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Copying Sheet to Sheet

Sub ABC()
dim rng1 as Range, rng2 as Range
Dim cell as Range, rw as Long
With Worksheets("Sheet1")
set rng1 = .Range(.Cells(1,1),.Cells(rows.count,1).End(xlup))
End With

With Worksheets("Sheet2")
rw = .Cells(rows.count,1).End(xlup).Row + 1
set rng2 = .Range(.Cells(1,1),.Cells(rows.count,1).End(xlup))
End With
for each cell in rng1
res = Application.Match(cell,rng2,0)
if not iserror(res) then
cell.EntireRow.copy Destination:=rng2.Parent.Cells(rw,1)
rw = rw + 1
end if
Next
End Sub

--
Regards,
Tom Ogilvy


"knowtrump" wrote
in message ...

I want to write a procedure/macro that will decide if n = 1 To 10000
Step 1 Cells(n, "?") .Value on Sheet 1 equal a Cell.Value on Sheet 2:
if TRUE then I want to copy the entire Sheet 1 Row onto consecutive
rows on sheet 2: then I want repeat the procedure for other values on
sheet 1, up to about a total of 100 values. Would anyone like to help?
Sounds challenging to me but might be a piece of cake for you experts.
Any replies, even comments on either my ignorance or nerve for asking
will be appreciated.


--
knowtrump
------------------------------------------------------------------------
knowtrump's Profile:

http://www.excelforum.com/member.php...o&userid=19664
View this thread: http://www.excelforum.com/showthread...hreadid=506107