JackDanIce
Well-known Member
- Joined
- Feb 3, 2010
- Messages
- 9,922
- Office Version
- 365
- Platform
- Windows
Hi,
I have a Master file with multiple child files in sub folders below it.
Each child file has a named range for a value and I want to update it from the Master file; the child files have Workbook_Open events.
The following approach will work but I suspect there are faster methods, could anyone suggest? Code is untested, assume Range("Child_Files") is a 2D range containing full UNC paths and at least 100 child files. Application.EnableEvents = False to prevent child file triggering any workbook_open events it has:
There may be 2 variables to update, it will also be updated on sheet object wAdmin in the child files.
TIA,
Jack
I have a Master file with multiple child files in sub folders below it.
Each child file has a named range for a value and I want to update it from the Master file; the child files have Workbook_Open events.
The following approach will work but I suspect there are faster methods, could anyone suggest? Code is untested, assume Range("Child_Files") is a 2D range containing full UNC paths and at least 100 child files. Application.EnableEvents = False to prevent child file triggering any workbook_open events it has:
Rich (BB code):
Sub Update_Value(byref vari as string)
Dim x as Long
Dim arr() as Variant
arr = Range("Child_Files").Value
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
For x = lbound(arr, 1) to ubound(arr, 1)
With workbooks.open arr(x,1)
wAdmin.Range("Variable1").Value = vari
.Close SaveChanges:=True
End With
Next x
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
Erase arr
End Sub
TIA,
Jack