Export Data to A new workbook

thunder_anger

Board Regular
Joined
Sep 27, 2009
Messages
206
Hi all
I know that i ask alot of questions here in the forum but what can i do, I am still learning

anyway

all i am to do is to export my data to another work book and that book will take the name stored in Range("S7")
and want to copy and past data to this work book as values anformats "there is alot of merged cells"
i recorded a macro and edited it but it stoped in the high lighted part below
Code:
Sub Macro1()
'
' Macro1 Macro
'

Dim mybook As Workbook

    Workbooks.Add
    Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
    Sheets("Sheet1").Activate
    Application.CutCopyMode = False
    ActiveSheet.DisplayRightToLeft = False
    Sheets("Sheet1").Select
    ActiveWorkbook.SaveAs Filename:="c:\" & Workbooks("Acceptance 1.xlsm").Sheets("production Parameters").Range("S7").Value & ".xlsx"
[B][COLOR=Red] Set mybook = Workbooks("Acceptance 1.xlsm").Sheets("production Parameters").Range("S7").Value & ".xlsx"[/COLOR][/B]
    Windows("Acceptance 1.xlsm").Activate
    Sheets("Production Parameters").Select
    Range("B1:U28").Select
    Selection.Copy
    mybook.Activate
    ActiveSheet.Paste
    Sheets("Sheet1").Select
    Sheets("Sheet1").Name = "Productio parameters"
    Sheets("Sheet2").Select
    Windows("Acceptance 1.xlsm").Activate
    Sheets("Material Report").Select
    Range("A1:E22").Select
    Application.CutCopyMode = False
    Selection.Copy
    mybook.Activate
    ActiveSheet.Paste
    Columns("E:E").EntireColumn.AutoFit
    Columns("D:D").EntireColumn.AutoFit
    Columns("B:B").EntireColumn.AutoFit
    Columns("C:C").EntireColumn.AutoFit
    Sheets("Sheet2").Select
    Sheets("Sheet2").Name = "Material Report"
    Sheets("Sheet3").Select
    Windows("Acceptance 1.xlsm").Activate
    Sheets("Costs Report").Select
    Range("C3:F27").Select
    Application.CutCopyMode = False
    Selection.Copy
    mybook.Activate
    ActiveSheet.Paste
    Columns("A:D").Select
    Columns("A:D").EntireColumn.AutoFit
    Sheets("Sheet3").Select
    Sheets("Sheet3").Name = "Costs Report"
    Sheets("Productio parameters").Select
    Application.CutCopyMode = False
    ActiveWorkbook.Save
    ActiveWindow.Close
    Sheets("Data Entry").Select
End Sub

any ideas
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,203,073
Messages
6,053,379
Members
444,660
Latest member
Mingalsbe

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top