Update value on multiple .xlsm files from parent .xlsm file

JackDanIce

Well-known Member
Joined
Feb 3, 2010
Messages
9,922
Office Version
  1. 365
Platform
  1. 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:
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
There may be 2 variables to update, it will also be updated on sheet object wAdmin in the child files.

TIA,
Jack
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Bump: Are there any faster ways to update a variable from parent file into multiple child files?
 
Upvote 0
Bump: guessing by lack of replies, apart from looping, opening, updating variable and closing each .xlsm file, there isn't a faster approach?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top