I have two macros. In the first certains cells in the worksheet contain the files that I need to open and copy information from them once I have inserted in a specific cell the location I need the information from. This needs to be repeated for each sheet in my workbook. I need to be able to use the defined string to activate/deactivate the other file. Can this be done? Here is a sample of my two macros. I know the coding is a little long and it could be simpler, therefore any improvement suggestions are welcomed.
Thanks,
OZ
Thanks,
OZ
Code:
Sub Update_WIPFlow_AllPlants()
' Loop through all sheets in the workbook by activating each at a time
Dim DIRECTORY As String
Dim UNITFLOW As String
Range("Z1").Select
DIRECTORY = ActiveCell.Value
Range("Z2").Select
UNITFLOW = ActiveCell.Value
Workbooks.Open Filename:=(DIRECTORY + UNITFLOW)
Windows("ME Performance Report Plants.xls").Activate
For i = 3 To Sheets.Count
Sheets(i).Activate
Application.Run "'ME Performance Report Plants.xls'!Get_UnitsFlow"
Next i
Windows(UNITFLOW).Activate
ActiveWindow.Close
Sub Get_UnitsFlow()
Range("U1").Select
Selection.Copy
Windows(UNITFLOW).Activate
Range("Q21").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("B3:G8,J3:R8,U3:W8").Select
Selection.Copy
Windows("ME Performance Report Plants.xls").Activate
Range("A12").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub