you probably don't have a drive U: change the path for the save as command to a valid one for your environment.
regards,
SweetEbird
you probably don't have a drive U: change the path for the save as command to a valid one for your environment.
regards,
SweetEbird
Hi
Thanks for getting back to me.
I have already changed the file path to my own drive and it still does not appear to work?
Thanks again
McCrimmon
Please post a copy of your workbook, I may be able to offer more help.![]()
Regards
Rick
Win10, Office 365
I took the above code and tweaked it a bit:
You have to distinguish the final sheet, because you cannot move a sheet out of a document if it is the only sheet. This also resolves any issues on the naming of the tabs (the prior version required that the sheets be named "Sheet3").![]()
Sub SplitBookIntoSheets() Dim i As Integer Dim ws As Worksheet Dim CntSheets As Long Dim FileFolder As String FileFolder = InputBox("Where would you like these saved?", "filename", "C:\Temp\") For i = 1 To Worksheets.Count CntSheets = Worksheets.Count If CntSheets <> "1" Then Sheets(CntSheets).Move ActiveWorkbook.SaveAs FileName:=FileFolder & ActiveSheet.Name & ".csv", FileFormat:=xlCSV ActiveWindow.Close Else ActiveWorkbook.SaveAs FileName:=FileFolder & ActiveSheet.Name & ".csv", FileFormat:=xlCSV ActiveWindow.Close End If Next i End Sub
I believe you weren't getting any error messages because the code suppressed those. I did not include those, because I need to know why something didn't do what I thought it would.
I hope this helps.
J
Last edited by VBA Noob; 12-01-2008 at 02:41 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks