Greetings
I have 16 Sheets in my workbook, I only want to copy 12 of them to a new workbook.
I am creating new workbooks based on the code below but its coping all 16 sheets.
the 12 sheets are named Jan through Dec
Sub copy()
Dim i As Integer
'Dim j As Integer
Dim employeeName As String, path As String, year As String
If MsgBox("This will save files in assigned folder. Continue?" _
, vbOKCancel, "Prompt") = vbCancel Then Exit Sub
year = Range("A1").Value
path = Range("A2").Value
Application.ScreenUpdating = False
For i = 1 To 27
Application.StatusBar = "Progress..: " & i & "/" & 8
employeeName = Cells(i + 2, 1)
Application.DisplayAlerts = False
If Dir(path & year, vbDirectory) = "" Then MkDir (path & year)
ActiveWorkbook.SaveAs Filename:=path & year & "\" & employeeName & ".xls"
Next
ActiveWorkbook.SaveAs Filename:=path & "SupervisorMasterControl.xls"
Application.DisplayAlerts = True
Application.StatusBar = "Updating links..."
Application.StatusBar = False 'return control to Excel
Application.ScreenUpdating = True
End Sub
I have 27 employees identified on Sheet1,A3:A30
and this creates 27 new workbooks for them including the 4 extra sheets I dont want/need them to see.
Would it be easier to create a second "Employee.xls" workbook and have it contain ONLY the 12 sheets? if so, how would I alter this code to allow for that?
I perfer to keep only a single workbook master but either way will work.
Any clues?
Bookmarks