How to pass value in cell between workbooks ?

G

Guest

I'm tring to pass value in cell between workbooks for example : value in cell A1 of Book1.xls pass to cell B1 of Book2.xls
with code
workbooks(book1.xls").worksheets("sheet1").range("A1").value = workbooks(book2.xls").worksheets("sheet1").range("B1").value
or something like that but not success. Could anyone give me the answer please.
 
S

Shailesh Shah

Hi,

It seems you have a missing ( " ) in workbooks(book1.xls") & in
Workbooks("Book2.xls") that cause error.

If your book1.xls & book2.xls are saved workbook, use this code.

workbooks("book1.xls").worksheets("sheet1").range("A1").value =
workbooks("book2.xls").worksheets("sheet1").range("B1").value

But if you have created new Book1 & Book2 and not yet saved then use
workbook name without extension as under.

workbooks("book1").worksheets("sheet1").range("A1").value =
workbooks("book2").worksheets("sheet1").range("B1").value



Regards,
Shah Shailesh
http://members.lycos.co.uk/shahweb/
 

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

Top