LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default update excel files using a vba script

In the files you want to share the data, you could open them and put in a
formula

in one cell
='C:\Myfolder\[exemple1.xls]Sheet1'!A2

and in another cell another formula

='C:\Myfolder\[exemple1.xls]Sheet1'!A3

Do this in each of the workbooks.

If you don't want a formula, then you would have to both the source workbook
and the destination workbook open at the same time (which you can do in code)

so in the source workbook you would have code like

Sub UpdateValues()

Dim rng1 as Range, bk as Workbook
Dim i as Long
set rng1 = Thisworkbook.Worksheets(1).Range("A2")
for i = 2 to 5
set bk = workbooks.open("C:\myfolder\exemple" & i & ".xls")
bk.worksheets(1).Range("A2") = rng1.Value
bk.Worksheets(1).Range("A3") = rng1.offset(1,0).Value
bk.Close SaveChanges:=True
Next

End Sub

--
Regards,
Tom Ogilvy

"adinic" wrote:


Hello. Is there a way i could update one or several files at once, using
data from another excel file? For exemple in file exemple1.xls i have in
cells a2 and a3 certain values that i want in files exemple2.xls and
exemple3.xls. I would need this for 2 or more files Thank you!


--
adinic
------------------------------------------------------------------------
adinic's Profile: http://www.excelforum.com/member.php...o&userid=31529
View this thread: http://www.excelforum.com/showthread...hreadid=533385


 
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
Update Excel Database via Access Main Database with a script Finnbar New Users to Excel 2 November 3rd 08 07:24 PM
Script for Multiple Files Neil Excel Discussion (Misc queries) 5 April 10th 08 10:13 PM
Stand alone VBA script files tishoo Excel Discussion (Misc queries) 6 December 29th 06 06:02 PM
Update a workbook from a script [email protected] Excel Discussion (Misc queries) 1 March 8th 06 02:30 PM
Script or Tool to Update Excel Links Just_Buy Excel Programming 1 April 13th 04 11:08 PM


All times are GMT +1. The time now is 05:24 PM.

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"