I need help converting this code to do mulitple copies using the Copy Before function. Also a next function argumenting files that have a worksheet nameD "COMPILED".
Sub Stat_Compiling()
Dim Thisworkbook As Workbook
Dim Compiledwkst As Worksheet
Dim Templateworkbook As Workbook
Dim NewFN As Variant
Application.ScreenUpdating = True
NewFN = Application.GetOpenFilename(FileFilter:="Excel Files (*.xlsx), *.xlsx", Title:="Please select a file", MultiSelect:=False)
If NewFN = False Then
MsgBox "Stopping because you did not select a file"
Exit Sub
Else
Set Thisworkbook = Workbooks.Open(Filename:=NewFN)
End If
Set Templateworkbook = Workbooks.Open("\\tsscitrix\Heat\Kim Comer\Phone System Reports\Template\Template.xlsx")
Templateworkbook.Sheets("COMPILED").Copy Before:=Thisworkbook.Sheets("1040")
Range("A1").Select
Cells.Replace What:="[Template.xlsx]", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Thisworkbook.Save
Templateworkbook.Close
Thisworkbook.Close
Application.ScreenUpdating = True
MsgBox "Done"
End Sub
Bookmarks