Sie sind auf Seite 1von 3

Sub RunMacro_Click() Dim Auxiliar, EIW, GBS, GBSLA, LA_GBS As String Dim CQtr, NQtr, Form_String As String If (MsgBox("Did

You Pre-Process 'GBSLA' File to Remove '#NA' Error..?", vbYesNo) = vbYes) Then Auxiliar = Sheet1.Cells(5, 3) & Sheet1.Cells(2, 7) EIW = Sheet1.Cells(6, 3) & Sheet1.Cells(2, 6) GBS = Sheet1.Cells(7, 3) & Sheet1.Cells(2, 5) GBSLA = Sheet1.Cells(8, 3) & Sheet1.Cells(2, 3) LA_GBS = Sheet1.Cells(9, 3) & Sheet1.Cells(2, 4) CQtr = Sheet1.Cells(1, 6).Value NQtr = Sheet1.Cells(1, 7).Value Application.Workbooks.Open Filename:=Sheet1.Cells(4, 3) & Auxiliar Application.ActiveWorkbook.ActiveSheet.Columns("A:AY").Delete Application.Workbooks.Open Filename:=Sheet1.Cells(4, 3) & GBS Application.Run Sheet1.Cells(12, 3).Value Application.ActiveWorkbook.Sheets("Complete Data").Activate ActiveSheet.Range("D3:AM65536").ClearContents ActiveSheet.Range("AO3:AY65536").ClearContents Application.Workbooks.Open Sheet1.Cells(4, 3) & LA_GBS, False Application.ActiveWorkbook.Sheets("Roadmap").Activate With Application.ActiveWorkbook.ActiveSheet .Unprotect .Cells.Select Selection.AutoFilter Selection.EntireRow.Hidden = False Selection.EntireColumn.Hidden = False .Range("N7:BV7").Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy End With Application.Workbooks(Auxiliar).Activate With ActiveWorkbook.ActiveSheet .Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False ActiveSheet.Columns("AU:BD").Delete Range("A1:AY1").Select Range(Selection, Selection.End(xlDown)).Select Selection.AutoFilter ActiveWorkbook.Save Range("C1").Select Selection.AutoFilter Field:=3, Criteria1:="=At Risk", Operator:=xlOr, _ Criteria2:="=Solid" Range("J1").Select Selection.AutoFilter Field:=10, Criteria1:=CQtr lRow = ActiveSheet.UsedRange.Rows.Count Range("A2:AJ" & lRow).Select Selection.Copy End With Application.Workbooks(GBS).Sheets("Complete Data").Activate

ActiveWorkbook.ActiveSheet.Range("D3").Select Selection.PasteSpecial xlPasteValues Application.CutCopyMode = False Application.Workbooks(Auxiliar).Activate ActiveWorkbook.ActiveSheet.Range("AL2:AV" & lRow).Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Application.Workbooks(GBS).Sheets("Complete Data").Activate Range("AO3").Select Range("AO3").PasteSpecial xlPasteValues Application.CutCopyMode = False Application.Workbooks(Auxiliar).Close False Application.Workbooks.Open Filename:=Sheet1.Cells(4, 3) & GBSLA Application.ActiveWorkbook.Sheets("Contract Table").Activate ActiveSheet.Range("A5:AL65536").ClearContents Application.Workbooks(LA_GBS).Sheets("Actuals CW").Activate ActiveWorkbook.ActiveSheet.Range("A5:AL5").Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Application.Workbooks(GBSLA).Sheets("Contract Table").Activate Application.ActiveWindow.ActiveSheet.Range("A5").PasteSpecial xlPasteValues Application.CutCopyMode = False Application.ActiveWorkbook.Sheets("Sector Reports").Visible = True Application.ActiveWorkbook.Sheets("Sector Reports").Select With ActiveSheet .Range("AS11").Formula = "='Contract Table'!L5" .Range("AS11").Copy .Range("AS11").Select Range(Selection, Selection.End(xlDown)).PasteSpecial xlPasteFormulas Calculate .Range("D11:AK11").Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy End With Application.Workbooks(GBS).Sheets("Complete Data").Activate lRow = Range("F3:F65536").End(xlDown).Row + 1 Range("F" & lRow).Select Selection.PasteSpecial xlPasteValues Application.CutCopyMode = False Application.Workbooks(GBSLA).Sheets("Sector Reports").Activate Application.ActiveSheet.Range("AM11:AW11").Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Application.Workbooks(GBS).Sheets("Complete Data").Activate Range("AO" & lRow).Select Selection.PasteSpecial xlPasteValues Application.CutCopyMode = False Columns("AO:AP").Select Selection.Replace What:="", Replacement:="NA", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Application.Workbooks(GBSLA).Close False Application.Workbooks(LA_GBS).Close False Application.Workbooks.Open Filename:=Sheet1.Cells(4, 3) & EIW Application.Workbooks(GBS).Sheets("Complete Data").Activate Form_String = "=VLOOKUP(J3,'" & EIW & "'!$E:$AS,41,0)" ActiveSheet.Range("AT3").Select ActiveSheet.Range("AT3").Formula = Form_String

Selection.Copy lRow = Range("F3:F65536").End(xlDown).Row ActiveSheet.Range("AT3:AT" & lRow).Select Selection.PasteSpecial xlPasteFormulas Calculate Selection.Copy Selection.PasteSpecial xlPasteValues Application.CutCopyMode = False ActiveSheet.Columns("AT").Select Selection.Replace What:="0", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Selection.Replace What:="#N/A", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False ActiveSheet.Range("A1").Select Application.Workbooks(EIW).Close False Application.Workbooks(GBS).Activate Application.Run Sheet1.Cells(13, 3).Value Application.ActiveWorkbook.Sheets("Complete Data").Activate Sheets("GMR Summary").Visible = False Sheets("Sector Summary").Visible = False Sheets("Industry Sol Summary").Visible = False Sheets("COMM").Visible = False Sheets("DIST").Visible = False Sheets("FSS").Visible = False Sheets("INDU").Visible = False Sheets("PUB").Visible = False Sheets("GB").Visible = False Sheets("Solution").Visible = False Sheets("Core - Invest Accounts").Visible = False Sheets("Complete Data").Visible = False Sheets("Menu").Range("A1").Select Application.ActiveWorkbook.Close True Else MsgBox "Please Pre-Process 'GBSLA' File & Then Re-Run This Macro...!!" Exit Sub End If End Sub

Bewerten