Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default Writing value to another file

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Writing value to another file

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

would be the typical syntax.

Steven wrote:

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


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Writing value to another file

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

--
Gary''s Student - gsnu200822


"Steven" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing to a .txt File Dan R. Excel Programming 2 March 23rd 07 04:34 PM
writing to a DB4 file dharp Excel Programming 2 August 18th 06 04:25 PM
Writing a CSV file guy Excel Programming 2 January 21st 05 09:57 AM
Writing a .txt file Claus[_2_] Excel Programming 2 September 27th 04 01:47 AM
file writing Mike[_49_] Excel Programming 0 November 22nd 03 06:57 PM


All times are GMT +1. The time now is 09:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"