I have a master workbook with one sheet that I need to be broken into many workbooks that each have a single worksheet.
These newly created workbooks will be created wh
Because you are still in CopyMode from Range("A" & last & ":F" & i).Copy
the .Insert
will insert the copied rows again. Therefore put a Application.CutCopyMode = False
right before Rows(1).EntireRow.Insert
to stop inserting copied rows again.
You need Workbook.SaveAs Method and Workbook.Close Method to save and close the workbooks.
NewBook.SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AccessMode, ConflictResolution, AddToMru, TextCodepage, TextVisualLayout, Local)
NewBook.Close(SaveChanges, Filename, RouteWorkbook)
eg. This should work:
NewBook.SaveAs FileName:="C:\Temp\MyFileName.csv", FileFormat:=xlCSV
NewBook.Close SaveChanges:=False
You should specify any Rows()
and Range()
with a worksheet like Master.Rows()
or NewBook.Worksheets("Sheet1").Range()
so that is clear in which workbook\worksheet the range/row is. Then you don't need Master.Activate