Copying cells...

  • Thread starter Thread starter Sylvia
  • Start date Start date
S

Sylvia

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

Thanks,
Sylvi
 
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
 
Back
Top