Sheets("sheet1").Range command between workbooks

G

Guest

I would like to use the e.g.
Sheets("sheet1").Range("ac2") = Sheets("sheet2").Range("b2")
command (which works within a wookbook) but between 2 workbooks. How can I
impose a value of workbook1 to workbook2 in the assumption that wookbook2 is
open?
 
G

Guest

General form is:
Workbooks("Workbook1").Worksheets("Sheet1").Range("ac2")=Workbooks("Workbook2").Worksheets("Sheet2").Range("b2")
Substitute in your workbook names (exactly as they show in the Excel title
bar when the workbook is open, or in the Project Explorer list in the VBA
editor).
 
G

Guest

thanks works

K Dales said:
General form is:
Workbooks("Workbook1").Worksheets("Sheet1").Range("ac2")=Workbooks("Workbook2").Worksheets("Sheet2").Range("b2")
Substitute in your workbook names (exactly as they show in the Excel title
bar when the workbook is open, or in the Project Explorer list in the VBA
editor).
 
C

Chip Pearson

Try something like

Workbooks("Book2.xls").Sheets("sheet1").Range("ac2") = _
Workbooks("Book1.xls").Sheets("sheet2").Range("b2")



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

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