#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Match Flies


Hi everybody,

I need your help. I have 2 Excel files. They are exactly the same. Eac
one has 5 worksheets.

I want to match them to each other. If I change some thing in de firs
file, work sheet 2 cel A2 for example. It wil change it automatical
also in the another file.

Ik hoop I have my quesion clear asked en I hoop to get an answear a
soon as possiable.

Kaind regards,

Leo1452 :confused

--
Leo145
-----------------------------------------------------------------------
Leo1452's Profile: http://www.excelforum.com/member.php...fo&userid=1646
View this thread: http://www.excelforum.com/showthread.php?threadid=27823

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Match Flies

Hi Leo,

This one works when you apply changes in a single sheet on one ore
multiple cells:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)

Application.ScreenUpdating = False
Application.DisplayAlerts = False

mySheet = Target.Worksheet.Index

Workbooks.Open Filename:="[Path] & bestand1.xls"

For myRow = Target.Row To (Target.Rows.Count + Target.Row - 1)
For myCol = Target.Column To (Target.Columns.Count + Target.Column -
1)
Workbooks("bestand1.xls").Worksheets(mySheet).Cell s(myRow,
myCol).Value =
Workbooks("bestand2.xls").Worksheets(mySheet).Cell s(myRow, myCol).Value
Next myCol
Next myRow

Workbooks("bestand1.xls").Save
Workbooks("bestand1.xls").Close

Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

Regards,
ManualMan
http://www.gamesXL.tk

PS. Aangezien jij volgens mij nederlands kan lezen heb ik hier en daar
wat nederlandse woorden laten staan.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Match Flies

Another approach if only one workbook is open at any given time:

Assumes names like mybook1.xls and mybook2.xls. Adjust as appropriate.


Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)

Application.ScreenUpdating = False
Application.DisplayAlerts = False

In instr(Thisworkbook.Fullname,1) then
Application.SaveCopyAs Filename:= _
Application.Substitute(thisworkbook.Fullname,1,2)
Else
Application.SaveCopyAs Filename:= _
Application.Substitute(thisworkbook.Fullname,2,1)
End if

Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

For information on Events:

http://www.cpearson.com/excel/event.htm
(Chip Pearson's site)

You may want to add similar code to the before save event.

--
Regards,
Tom Ogilvy


"Leo1452" wrote in message
...

Hi everybody,

I need your help. I have 2 Excel files. They are exactly the same. Each
one has 5 worksheets.

I want to match them to each other. If I change some thing in de first
file, work sheet 2 cel A2 for example. It wil change it automaticaly
also in the another file.

Ik hoop I have my quesion clear asked en I hoop to get an answear as
soon as possiable.

Kaind regards,

Leo1452


--
Leo1452
------------------------------------------------------------------------
Leo1452's Profile:

http://www.excelforum.com/member.php...o&userid=16469
View this thread: http://www.excelforum.com/showthread...hreadid=278239



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Match Flies

Presumably the first word in the quoted line underneath

In instr(Thisworkbook.Fullname,1) then


should be "If" instead of "In" to make the sub work real smooth
Regards,
ManualMan
http://www.gamesXL.tk

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
Lookup Formula: Return 1st match, then 2nd match, then 3rd match Scott Excel Discussion (Misc queries) 4 December 11th 09 05:50 AM
Macro for variable rows (fruit flies) Lisa Anne Excel Discussion (Misc queries) 2 July 2nd 08 12:20 PM
Change in how Excel opens Text flies after applying MS08-014 rich Excel Discussion (Misc queries) 1 March 27th 08 03:16 PM
Excel 2002: Can I save all the flies in the window at one go ? Mr. Low Excel Discussion (Misc queries) 2 February 27th 08 02:32 PM
Lookup? Match? pulling rows from one spreadsheet to match a text f cjax Excel Worksheet Functions 3 July 21st 06 02:51 PM


All times are GMT +1. The time now is 01:57 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"