Writing value to another file

S

Steven

I have this in code:

Range("OpenFile1.xls!A1").Value = "First Option"

This writes "First Option" to Sheet1 of the file I think becuase that is the
active sheet. "OpenFile1.xls" is open.

How can I write "First Option" to "OpenFile1.xls" Sheet2 A1. I dont want to
have to actually activate the window but just write to it.

Thank you,

Steven
 
D

Dave Peterson

workbooks("openfile1.xls").worksheets("sheet2").range("a1").value _
= "First Option"

would be the typical syntax.
 
G

Gary''s Student

Sub servient()
Workbooks("OpenFile1.xls").Sheets("Sheet2").Range("A1").Value = "first Option"
End Sub
 

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