Hello,
I have a excel file with two sheets.
Sheet1 (Workflow tracker) is used by operators to enter values, delivery periods, dates ect.
Sheet2 (Dashboard) is used to display a summary of the data in Sheet 1 for the Management guys.
Right now it is working fine with both the sheets in the same excel file.
What I want to do is to move sheet2 from excel file to a new excel file, so that there are 2 separate excel files. one for the operator and 2nd for the management guys.
Can anyone help me with the code, how to call the excel file from the 2nd excel file. Below is the code which is right now working with both the sheets in the same excel file.
Option Explicit
Dim TempVal As String
Private Sub Worksheet_Activate()
Application.DisplayAlerts = False
TempVal = Range("G5").Value
Range("G5").Value = "Wait Refreshing Data"
Application.ScreenUpdating = False
If ActiveSheet.AutoFilterMode = False Then
Range("A5:G65536").Select
Selection.AutoFilter
Else
If ActiveSheet.FilterMode = True Then
ActiveSheet.ShowAllData
End If
End If
Range("A6").FormulaR1C1 = _
"=IF(OR('Daily Workflow Tracker'!RC[20]>=3,'Daily Workflow Tracker'!RC[22]>0),'Daily Workflow Tracker'!RC,"""")"
Range("B6").FormulaR1C1 = "=IF(RC[-1]<>"""",'Daily Workflow Tracker'!RC[5],"""")"
Range("C6").FormulaR1C1 = "=IF(RC[-2]<>"""",'Daily Workflow Tracker'!RC[8],"""")"
Range("D6").FormulaR1C1 = "=IF(RC[-3]<>"""",'Daily Workflow Tracker'!RC[10],"""")"
Range("E6").FormulaR1C1 = "=IF(RC[-4]<>"""",'Daily Workflow Tracker'!RC[16],"""")"
Range("F6").FormulaR1C1 = "=IF(RC[-5]<>"""",'Daily Workflow Tracker'!RC[17],"""")"
Range("A6:F6").Copy
Range("A7:A65536").Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Range("A6:F65536").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Range("A6:F65536").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("A6:F65536").Select
ActiveSheet.Range("$A6:$F65536").AutoFilter Field:=1, Criteria1:="="
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.EntireRow.Delete
ActiveSheet.ShowAllData
Range("F65536").End(xlUp).Select
Range(Selection, "A6").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
Range("G5").Value = TempVal
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Range("A5").Select
End Sub
Please help
Thanks
Vishal