richardcarter
Board Regular
- Joined
- Dec 10, 2003
- Messages
- 77
I have a main workbook (wokbook A) which just contains a list of names in col A. For each name, I need to create a new workbook, then populate it with data coming from another workbook (workbook B), then save the newly created workbook with the persons name in Col A .Reapeat for all people listed in Column A.
I was trying to adapt the following code which I was kindly provided by ranman in this post https://www.mrexcel.com/forum/members/ranman256.html. This code just creates blank new files without populating them, but for the life of me I cannot find a way to populate them before they are saved!
Hope someone can help.. many thanks.
Sub MakeSheetsFromList()
Dim col As New Collection
dim I as integer
dim vName
On Error Resume Next
Range("A1").Select
While ActiveCell.Value <> ""
col.Add ActiveCell.Value
ActiveCell.Offset(1, 0).Select 'next row
Wend
For i = 1 To col.Count
vName = "C:\My Documents" & col(i)
Workbooks.Add
ActiveWorkbook.SaveAs vName
ActiveWorkbook.Close False
Next
Set col = Nothing
End Sub
I was trying to adapt the following code which I was kindly provided by ranman in this post https://www.mrexcel.com/forum/members/ranman256.html. This code just creates blank new files without populating them, but for the life of me I cannot find a way to populate them before they are saved!
Hope someone can help.. many thanks.
Sub MakeSheetsFromList()
Dim col As New Collection
dim I as integer
dim vName
On Error Resume Next
Range("A1").Select
While ActiveCell.Value <> ""
col.Add ActiveCell.Value
ActiveCell.Offset(1, 0).Select 'next row
Wend
For i = 1 To col.Count
vName = "C:\My Documents" & col(i)
Workbooks.Add
ActiveWorkbook.SaveAs vName
ActiveWorkbook.Close False
Next
Set col = Nothing
End Sub