I have a worksheet on which I have consolidated various macros performing different actions into one macro. Basically the macro copies information from one tab to the active tab, then clean up the data, add new lines and copy data into those lines. This works perfectly. What I need to do to finalize the process is to copy all the data on the active sheet, create a new workbook and then paste the data into that workbook. I have recorded a macro which do all this but if I'm trying to use the code of that macro in my original macro I get the Run-time error 1004: Application-defined or Object-defined error. This is the code of the Macro that works:
Sub CreateFile()
Dim rng As Range
Dim wbk As Workbook
Set rng = Sheets(Sheet7).Range("A:F")
rng.Cells.Copy
Set wbk = Workbooks.Add
ActiveSheet.Paste.rng
End Sub
When I use this code it does not create a new workbook and I end up getting a Type mismatch error.