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 cells...

Dim sh1 as Worksheet, sh2 as Worksheet
Dim cell as Range
set sh1 = Workbooks("SourceBook.xls").Worksheets(1)
set sh2 = Workbooks("DestBook.xls").Worksheets(1)
for each cell in Sh1.Range("A2:A50")
if cell.Value = "Copy" then
cell.EntireRow.copy Destination:=sh2.Cells(cell.row,1)
end if
Next

--
Regards,
Tom Ogilvy


"Sylvia" wrote in
message ...

I want to write a macro for copying the cells from file1 to file2. The
data will be there only in the 2nd row.
The condition is, I want to copy only that perticular cell at the
corresponding cell of other file
For eg. if the data is there at the position "A2" and "A4" in File1
then I want to copy this data in the file2 at "A2" and "A4" position
only.

Thanks,
Sylvia


--
Sylvia
------------------------------------------------------------------------
Sylvia's Profile:

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