ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to pass value in cell between workbooks ? (https://www.excelbanter.com/excel-programming/283908-how-pass-value-cell-between-workbooks.html)

Chanon

How to pass value in cell between workbooks ?
 
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.

Shailesh Shah[_2_]

How to pass value in cell between workbooks ?
 
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/


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 04:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com