Hi im using Split an Excel File in to Many using VBA from Chandoo.org
In the SaveAs part how would I change "& cell.Value &" to something like "& vlookup(cell.Value,MyNamedRange,2,0) &"
In the SaveAs part how would I change "& cell.Value &" to something like "& vlookup(cell.Value,MyNamedRange,2,0) &"
Code:
Dim cell As Range
Dim curPath As String
curPath = ActiveWorkbook.Path & "\"
For Each cell In Range("lstSalesman")
[valSalesman] = cell.Value
Range("myList").AdvancedFilter Action:=xlFilterCopy, _
criteriarange:=Range("Criteria"), copyToRange:=Range("Extract"), unique:=False
Range(Range("Extract"), Range("Extract").End(xlDown)).Copy
Workbooks.Add
ActiveSheet.Paste
ActiveWorkbook.SaveAs Filename:=curPath & cell.Value & Format(Now, "dmmmyyyy-hhmmss") & ".xlsx", _
FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWindow.Close
Range(Range("Extract"), Range("Extract").End(xlDown)).ClearContents
Next cell