Hi Al
Not necessarily, no. The problem is that I do not know whether you want to
use the exact cell addresses to create these new range names, nor do I know
the location of the other sheets. What I suggested, is merely a starting
point to work from, which is already faster than Insert|Name|Define, as you
can use <Ctrl><n> or something to that effect, to run the macro.
You can sequence through the workbooks, provided that you put them all in
one directory or folder, by creating a FOR DO loop, to do the name creation
routine x number of times, if the range names are all in the same cells.
You can also take a workbook, create all the required names, save, and move
onto the next workbook, where the whole routine will be repeated until there
are no more files in the folder.
However, for me to do that, I will need to know a lot more than I do at
present. As I said, I do not have the names, I do not have the cell
addresses, and I do not know whether the workbooks are going to have the new
range names in the same cell addresses as the new book. You see, there has
to be method in our madness, for PC's to do our work
You can however expand on my suggestion, you can for example code in the
range names and addresses where you want to create these, you can write a
file save routine into the procedure, to save every file where you have
created names, and you can let the macro open the next file.
If for example you are going to put all the files in one folder, you can use
the command ChDir("New Folder Name") to go to the specified directory, or
merely put the folder name in a variable.
Use a variable to hold the description of files you want to open, eg fType
as a string variable, and a variable to hold the file names, such as fName
Insert a statement that checks for files, such as
Dim fName as string
Dim targetDir as String
Dim fType as String
targetDir = 'insert the target directory or folder
fType = "*.xls"
fName = Dir(TargetDir & "\" & FileType
If fName = "", Then
MsgBox "No files matching " & fName
'and after that a statement to open the file, such as
Else
Do
Workbooks.Open filename:=fName
'do your thing
'Save the file
ActiveWorkbook.Save
'close the workbook
ActiveWorkbook.Close
fName = Dir()
loop until fName = ""
End If
Exit sub
Play with this, and post back if you have a problem!