Hi everyone, i have this macro that opens an excel workbook, in a folder and copies the contents to the existing open workbook. I am hoping someone can help me modify my macro to look into the existing open workbook for "week 1" worksheet. If it is allreay there, id like the macro to open a message box, saying "already done" and stop, so it doesn't create duplicates. i.e. "week 1(2)". Here is the macro to help with the MOD:
Thanks all in advance
sd
Code:
Sub Get_Current_Scheduling_Template()
Dim wbThis As Workbook
Dim wbThat As Workbook
Dim ws As Worksheet
Dim x As Integer
Dim y As Integer
Application.ScreenUpdating = False
Set wb = Workbooks.Open(Filename:="S:\WASeattle\WFM\Test\Retail Store Scheduling Template.xls")
Set i = ActiveWorkbook.Sheets
For Each sh In i
sh.Visible = True
Next
Windows("Retail Store Scheduling Template.xls").Activate
Sheets(Array("Month at a Glance", "Daily Budget for the Month", "Week 1", _
"Week 1 Chart", "Week 2", "Week 2 Chart", "Week 3", "Week 3 Chart", "Week 4", _
"Week 4 Chart", "Week 5", "Week 5 Chart", "Productivity Calendars", _
"Schedule at a Glance", "Peak Hours", "Productivity Calendar Mapping", _
"Peak Hr Daily Allocation", "Store Productivity Mapping", "Store Names", _
"Labor Budget")).Select
Sheets("Month at a Glance").Activate
Sheets(Array("Month at a Glance", "Daily Budget for the Month", "Week 1", _
"Week 1 Chart", "Week 2", "Week 2 Chart", "Week 3", "Week 3 Chart", "Week 4", _
"Week 4 Chart", "Week 5", "Week 5 Chart", "Productivity Calendars", _
"Schedule at a Glance", "Peak Hours", "Productivity Calendar Mapping", _
"Peak Hr Daily Allocation", "Store Productivity Mapping", "Store Names", _
"Labor Budget")).Copy Before:=Workbooks("WFMToolbackupLiteDateImport3.xlsm"). _
Sheets(2)
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Schedule Dashboard" And ws.Name <> "Week 1" And ws.Name <> "Week 2" And ws.Name <> "Week 3" And ws.Name <> "Week 4" And ws.Name <> "Week 5" Then ws.Visible = xlSheetHidden
Next
Sheets("Schedule Tool").Visible = True
Sheets("Schedule Tool").Select
Range("A1").Select
Sheets("Schedule Dashboard").Select
Sheets("WorksheetList").Visible = True
Sheets("WorksheetList").Select
Cells.Select
Selection.ClearContents
Range("A1").Select
Sheets("WorksheetList").Select
Windows("Retail Store Scheduling Template.xls").Activate
With ThisWorkbook.Worksheets("WorksheetList")
.Range("A:A").ClearContents
For Each ws In ActiveWorkbook.Worksheets
y = y + 1
.Range("A" & y) = ws.Name
Next ws
End With
For Each WkbkName In Application.Workbooks()
If WkbkName.Name <> ThisWorkbook.Name Then WkbkName.Close WkbkName.Saved = False
Next
Sheets("WorksheetList").Visible = False
Sheets("Schedule Dashboard").Select
Range("B1").Select
Application.ScreenUpdating = True
End Sub
Thanks all in advance
sd