Copying cells...

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
 
T

Tom Ogilvy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top