Jeff
1) By global variable do you mean a Named/defined
range ?
2) Have you written a macro ??
If YES to both then to get you started;
1) If you haven't already, then place all files
in a dir
2) Open all files via a loop 1 by 1
3) do your search
4) close & save
5) Loop
eg.
Sub LoadandChange()
Dim fs
Dim LI As String
Dim i As Integer
LI = "C:\Excelfiles"
Set fs = Application.FileSearch
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error GoTo ErrH
With fs
.LookIn = LI
.Filename = "*.xls"
If .Execute <> 0 Then
For i = 1 To .FoundFiles.Count
Workbooks.Open Filename:=.FoundFiles(i)
ActiveWorkbook.Names("test").Delete
ActiveWindow.Close True
Next i
Else
MsgBox "There were no files found " & LI
End If
End With
ErrH:
If ActiveWorkbook.Name <> ThisWorkbook.Name Then ActiveWorkbook.Close False
Application.ScreenUpdating = True
Application.DisplayAlerts = True
If Not Err Then Exit Sub
MsgBox Err.Number & ":=" & Err.Description, vbMsgBoxHelpButton, "Error", Err.HelpFile, Err.HelpContext
End Sub
NB: just an example not fully tested
Ivan
Ivan,
Big thanks for your help! I wasn't too clear when i said what i wanted to replace, sorry about that. I acually need to replace a line of macro code.
Thanks,
Jeff