Hi guys,
I am totally new to writing code and dont have much of a clue!! Tryiing to put bits and pieces together using books.
I have a list of 4000 reference numbers and for each of these I want to create a seperate workbook with the name of the referenc number. However, having a template setting. The current code that i have done, saves the existing file so it has existing information on it whiCh I dont want. To, sum up....I wnt excel to loop through my list creating a new file named with each of the refernce numbers stored in a directory of my prference...
Sounds confusing....I know..
Hope somebody can help....this is what I have so far:
Sub SaveFileAsDate()
Dim WSName As String, CName As String, Directory As String, savename As String
Dim NextRow As Long
Dim cellvalue As Boolean
WSName = "Sheet1"
'change "Sheet1" to sheet tab name containing cell reference
CName = "A1"
'change "A1" to the cell with your date
' Ensure Sheet 1 is active
Sheets("Sheet1").Activate
NextRow = Application.WorksheetFunction. _
CountA(Range("A:A"))
Row = 1
cellvalue = True
Do While cellvalue
Directory = "C:\Documents and Settings\Hdavda\Desktop\Test\"
savename = Sheets("Sheet1").Cells(Row, 1).Text
ActiveWorkbook.SaveAs Filename:=Directory & savename & ".xls"
Row = Row + 1
If Row > NextRow Then
cellvalue = False
End If
Loop
End Sub
Bookmarks