Since we are already passing the "job" variable from sub to sub in the other macros, we'll do the same here. Change this macro to accept the same parameter:
Sub Add_TimeSheet(Job As String) Workbooks.Open Filename:= _ "C:\Documents and Settings\colins\Desktop\ProjectManager\Timesheet.xlsm" Sheets("Timesheet").Copy After:=Sheets(1) Range("C3") = Response Range("C4") = Job ActiveSheet.Name = Response ActiveWorkbook.Save ActiveWindow.Close End Sub
Then in the main index macro, add that parameter:
Sub Add_Index(Job As String, Adj As Long) Response = Application.InputBox("Enter name of new employee", Type:=2) If Response = "False" Then Exit Sub Application.ScreenUpdating = False Call Add_BudgetDaily(Job) Call Add_Employee(Job) Call Add_Employee_Profile Call Add_Project_Schedule(Job, Adj) '2nd parameter is the offset from the title Call Add_Travel Call Add_TimeSheet(Job) Application.ScreenUpdating = True End Sub
NOTE: For the sake of clarity reading this code, you should consider changing the name of the variable that holds the employee name entered from Response to EmpName so that it logically indicates what this variable holds. You would have to edit all the references to RESPONSE through the whole module, but it would be worth it.
You could probably press CTRL-H and replace all the references at once...
Last edited by JBeaucaire; 03-03-2010 at 08:03 PM.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks