Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Lookup Formula: Return 1st match, then 2nd match, then 3rd match | Excel Discussion (Misc queries) | |||
Macro for variable rows (fruit flies) | Excel Discussion (Misc queries) | |||
Change in how Excel opens Text flies after applying MS08-014 | Excel Discussion (Misc queries) | |||
Excel 2002: Can I save all the flies in the window at one go ? | Excel Discussion (Misc queries) | |||
Lookup? Match? pulling rows from one spreadsheet to match a text f | Excel Worksheet Functions |