Good Day Experts
I need a bit of help with my code please.
I have a workbook that will serve as a master workbook which i need to have a button in that the user can press to create a new workbook with name based on![]()
Sheets(("NEW MASTER ORDER FORM").Range("F2").value
needs to be created in the new workbook with all data from the original workbook in, but formulas removed.![]()
Sheets("NEW MASTER ORDER FORM") and Sheets("Item Qty Pivot") and Sheets("Employee Deduction Pivot")
The code i have below(modified from code found on the web....thanks to the original creator if you see this), does all that, but the sheets created in the new workbook comes out blank. What am i missing?
![]()
Sub MySheetCopy() ScreenUpdating = False Dim mySourceWB As Workbook Dim mySourceSheet As Worksheet Dim myDestWB As Workbook Dim myNewFileName As String ' First capture current workbook and worksheet Set mySourceWB = ActiveWorkbook Set mySourceSheet = ActiveSheet ' Build new file name based myNewFileName = mySourceWB.Path & "\" & ActiveSheet.Range("F2").Value & ".xlsx" ' Add new workbook and save with name of sheet from other file Workbooks.Add ActiveWorkbook.SaveAs Filename:=myNewFileName Set myDestWB = ActiveWorkbook ' Copy over sheet from previous file mySourceWB.Activate Sheets("NEW MASTER ORDER FORM").Select myDestWB.Activate ActiveSheet.Copy After:=Worksheets(Sheets.Count) On Error Resume Next ActiveSheet.Name = "NEW MASTER ORDER FORM" mySourceWB.Activate Sheets("Item Qty Pivot").Select myDestWB.Activate ActiveSheet.Copy After:=Worksheets(Sheets.Count) On Error Resume Next ActiveSheet.Name = "Item Qty Pivot" mySourceWB.Activate Sheets("Employee Deduction Pivot").Select myDestWB.Activate ActiveSheet.Copy After:=Worksheets(Sheets.Count) On Error Resume Next ActiveSheet.Name = "Employee Deduction Pivot" Application.CutCopyMode = False ' Resave new workbook ActiveWorkbook.Save End Sub
Bookmarks