98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Access VBA Training and help » Excel macro to split data into separate files | Access forum
Excel macro to split data into separate files | Access forum
Resolved · Low Priority · Version 2007
Marta has attended:
Access VBA course
Excel macro to split data into separate files
How can I set up a macro that would split my Excel data into separate files based on information within the file (for example a list of agencies) and save the files separately naming them appropriately for each agency?
RE: Excel macro to split data into separate files
Hi Marta, thanks for your query. You'll need to amend the following for your purposes but this is the code to dump out the activesheet as a standalone file. You'll need to loop through your agency names and problem select particular ranges and/or copy them onto fresh sheets, but the whole thing can be done invisibly. Here's the basic code:
-------
Dim mynewfilename As String
Dim myagencyname as string
myagencyname = [Your code here]
mynewfilename = "C:\" & myagencyname & ".xls"
Activesheet.Select
Activesheet.Copy
ActiveWorkbook.SaveAs Filename:=mynewfilename
ActiveWorkbook.Close
-------
Hope this helps,
Anthony
Fri 16 Mar 2012: Automatically marked as resolved.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Access tip:Create An Inaccessible Field On A FormThere is sometimes a need to make a field in a form look like a normal field but be completely inaccessible to the user. To do this: |