Merge Sheet from one workbook to another - assistance with existing code
I aquired this code to pull in (Sheet1) from another workbook and merge it into my master workbook. Its working but..
The problem is when the tab is pulled in from WB2 it needs to be placed infront of Sheet1, its currently coming in and going to the last tab. How do you bring it in so it is 1st tab? also once it has been pulled into the master file I need to protect this sheet before saving and exit.
Dim objExcel
Dim objWB1
Dim objWB2
Dim ws
Set objExcel = CreateObject("Excel.Application")
objExcel.DisplayAlerts = False
Set objWB1 = objExcel.Workbooks.Open("c:\SOURCE_TAB_Benefits.xlsm")
Set objWB2 = objExcel.Workbooks.Open("c:\BENEFITS_Run.xlsx")
For Each ws In objWB1.Sheets
ws.Copy objWB2.Sheets(objWB2.Sheets1.Count)
Next
objWB1.Close False
objWB2.Save
objWB2.Close
With objExcel
.DisplayAlerts = True
.Quit
End With
Set objExcel = Nothing
MsgBox "Done!"
No comment has been added to this question in more than 14 days, so it is now classified as abandoned.
I have recommended this question be closed as Shums (42046951)
If you feel this question should be closed differently, post an objection and a moderator will read all objections and then close it as they feel fit. If no one objects, this question will be closed automatically the way described above.
I have recommended this question be closed as Shums (42046951)
If you feel this question should be closed differently, post an objection and a moderator will read all objections and then close it as they feel fit. If no one objects, this question will be closed automatically the way described above.