I have a master workbook in excel that constists of some macros on saving I make a copy of a worksheet and save that work sheet as a new workbook. What I would like to do is copy a macro across to the newly saved workbook
Here is a copy of the macro I use to save the worksheet
Sub SaveReport()
'Copy worksheet
Application.ScreenUpdating = False
Dim wb As Workbook
Dim NewShtName As String
NewShtName = "Charge Sheet " & RN
Sheets("Charge sheet").copy
Set wb = ActiveWorkbook
wb.Sheets("Charge sheet").Name = NewShtName
File_To_SaveAs_Name = Application.GetSaveAsFilename( _
fileFilter:="Excel files (*.xls), *.xls")
ActiveWorkbook.SaveAS Filename:=File_To_SaveAs_Name, CreateBackup:=False
Workbooks("charge out sheet.xlt").Close
End Sub
And a copy of the macro I wish to copy to the new workbook:
Sub InsertRow()
With ActiveSheet
.Unprotect Password:="password"
Dim Rng, n As Long, k As Long
Application.ScreenUpdating = False
Rng = InputBox("Enter number of rows required.")
If Rng = "" Then Exit Sub
Range(ActiveCell, ActiveCell.Offset(Val(Rng) - 1, 0)).EntireRow.Insert
'need To know how many formulas To copy down.
'Assumesfrom A over To last entry In row.
k = ActiveCell.Offset(-1, 0).Row
n = Cells(k, 256).End(xlToLeft).Column
Range(Cells(k, 1), Cells(k + Val(Rng), n)).FillDown
.Protect Password:="password"
End With
End Sub
Can any one help on this
Here is a copy of the macro I use to save the worksheet
Sub SaveReport()
'Copy worksheet
Application.ScreenUpdating = False
Dim wb As Workbook
Dim NewShtName As String
NewShtName = "Charge Sheet " & RN
Sheets("Charge sheet").copy
Set wb = ActiveWorkbook
wb.Sheets("Charge sheet").Name = NewShtName
File_To_SaveAs_Name = Application.GetSaveAsFilename( _
fileFilter:="Excel files (*.xls), *.xls")
ActiveWorkbook.SaveAS Filename:=File_To_SaveAs_Name, CreateBackup:=False
Workbooks("charge out sheet.xlt").Close
End Sub
And a copy of the macro I wish to copy to the new workbook:
Sub InsertRow()
With ActiveSheet
.Unprotect Password:="password"
Dim Rng, n As Long, k As Long
Application.ScreenUpdating = False
Rng = InputBox("Enter number of rows required.")
If Rng = "" Then Exit Sub
Range(ActiveCell, ActiveCell.Offset(Val(Rng) - 1, 0)).EntireRow.Insert
'need To know how many formulas To copy down.
'Assumesfrom A over To last entry In row.
k = ActiveCell.Offset(-1, 0).Row
n = Cells(k, 256).End(xlToLeft).Column
Range(Cells(k, 1), Cells(k + Val(Rng), n)).FillDown
.Protect Password:="password"
End With
End Sub
Can any one help on this