Hi All,
The below code only copy pastes values in the sheet that is generated. How do i get it to copy & paste formulas and formats in the sheet that is generated.
[pre]
[/pre]
The below code only copy pastes values in the sheet that is generated. How do i get it to copy & paste formulas and formats in the sheet that is generated.
[pre]
Code:
Sub breakMyList()
' This macro takes values in the range myList
' and breaks it in to multiple lists
' and saves them to separate files.
Dim cell As Range
Dim curPath As String
curPath = ActiveWorkbook.Path & ""
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each cell In Range("Accountbutton")
[ValAccount] = cell.Value
Range("Mylist").AdvancedFilter Action:=xlFilterCopyFormulas, _
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
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub