Link to home
Start Free TrialLog in
Avatar of danisham
danishamFlag for United States of America

asked on

Exporting individual Excel sheets to individual files

My supervisor was wondering when in a workbook, could you export the individual sheet to its own file? Instead of copying and pasting all of the values?
ASKER CERTIFIED SOLUTION
Avatar of McOz
McOz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can simply save the file as a txt or csv file and, aside from a warning, the current sheet will be exported.  However, this will only be values.

If you want to move/copy the sheet, open the second workbook then in the first, right-click on the tabs at the bottom and and pick "Move or Copy", in the dropdown, pick the other workbook, then pick a place to move it to (for a copy, check the box at the bottom.)
sorry...the copy/move was mentioned by mcOz...so only export to a new format if you want values but not formulas.
Avatar of danisham

ASKER

Thanks McOz! I should have tried the obvious move / copy solution but didn't have time to fool around with the problem. May I ask where I would insert that code?
Avatar of McOz
McOz

Sorry about the delay --

To insert the VBA code as a macro:
1. press Alt+F11 to open Microsoft Visual Basic
2. click Insert > Module
3. paste the attached code into the window that appears. This code will give the user a "Save as" box, so they can choose where to save and what to name the new file.
4. Save, and close Visual Basic
5. now you can assign this macro to a keyboard shortcut or button to run it.

McOz
Sub SaveActiveSheet()
    ActiveSheet.Move
    fname = Application.GetSaveAsFilename("NewWorkbook", "Excel Files (*.xls), *.xls")
    If fname <> False Then ActiveWorkbook.SaveAs Filename:=fname, FileFormat:= _
        xlOpenXMLWorkbook, CreateBackup:=False
End Sub

Open in new window