View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Replacing One Sheet in Several Files

Try this Mark
copy the macro in "c:\work\source.xls"
file path/names in Sheets("Sheet1").Range("A1:A40")


Sub test()
Dim Wb As Workbook
Dim cell As Range
Application.ScreenUpdating = False
For Each cell In ThisWorkbook.Sheets("Sheet1").Range("A1:A40")
On Error Resume Next
Set Wb = Workbooks.Open(cell.Value)
Application.DisplayAlerts = False
Wb.Sheets("MKR15").Delete
Application.DisplayAlerts = False
ThisWorkbook.Sheets("MKR15").Copy after:=Wb.Sheets(Sheets.Count)
Wb.Close True
Next
Application.ScreenUpdating = True
End Sub



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Mark" wrote in message om...
Need to replace one sheet named "MKR15" in 40 different files.
The file containing the new copy of "MKR15" is "c:\work\source.xls".

A list of the file names (including paths) is in "filelist.xls" in cells a1:a40.

I'd like to write VB code to perform this operation.

Any suggestions?

Thanks, Mark