copy workbook to new workbook based on cell value
Sub Copyfiles()
Set fscopy = CreateObject("Scripting.FileSystemObject")
RowCount = 1
Do While Range("A" & RowCount) < ""
OldName = Range("A" & RowCount)
NewName = Range("B" & RowCount)
fscopy.CopyFile OldName, NewName
RowCount = RowCount + 1
Loop
End Sub
"ajd" wrote:
I'd like to copy an existing workbook (that's closed, preferably) and name
the copy based on cell values. So, for example in column A of the active
workbook I have a list of different excel workbooks that are closed (with the
file path), and in column B I have a list of names that I want to call the
copied workbooks. For all of the items in the list I'd like to copy the
respective workbook and give it the listed name. I figure I need a VBA loop,
but have no idea on the commands needed. Thanks.
|