Sub TexttoColumn(ColIndex As Long, DestCell)
ActiveWorkbook.Sheets("TFSDump").Activate
ActiveWorkbook.Sheets("TFSDump").Cells(3, ColIndex).Select
ActiveWorkbook.Sheets("TFSDump").Range(ActiveCell, ActiveCell.End(xlDown)).Select
Application.DisplayAlerts = False
Selection.TextToColumns Destination:=Range(DestCell), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1)), _
TrailingMinusNumbers:=True
Application.DisplayAlerts = True
End Sub
Sub InsertFormula(columnname As String, j As Integer)
Dim LastColumn As Integer
Dim i As Integer
Dim formula As String
Dim sprinttb As ListObject
Dim sd As Integer
Dim ed As Integer
Dim tbcolumn As String
Set sprinttb = ActiveWorkbook.Sheets("InputData").ListObjects("Table11")
For i = 1 To sprinttb.Range.Rows.Count
If Not sprinttb.DataBodyRange Is Nothing Then
If sprinttb.DataBodyRange.Cells(i, 1).Value = "Start Date" Then
sd = sprinttb.DataBodyRange.Cells(i, 2).Row
ed = sd + 1
Exit For
End If
End If
Next
LastColumn = ActiveWorkbook.Sheets("TFSDump").Cells(2, 1).End(xlToRight).Column
For i = 1 To LastColumn
If ActiveWorkbook.Sheets("TFSDump").Cells(2, i).Value = columnname Then
If j = 1 Then
i = LastColumn - i - j
Exit For
Else
i = LastColumn - i
Exit For
End If
End If
Next
tbcolumn = ActiveWorkbook.Sheets("TFSDump").Cells(3, LastColumn - j).ListObject.Name
If j = 1 Then
tbcolumn = tbcolumn & "[Closed in Current Sprint]"
Else
tbcolumn = tbcolumn & "[Current Sprint Items]"
End If
formula = "=IF(AND(RC[-" & i & "]>InputData!R" & sd & "C4,RC[-" & i & "]<(InputData!R" & ed & "C4+1)),""Yes"",""No"")"
ActiveWorkbook.Sheets("TFSDump").Range(tbcolumn).Value = formula
End Sub
Sub Disconnect_All_Slicer()
Dim oSliceCache As SlicerCache
Dim PT As PivotTable
Dim i As Long
For Each oSliceCache In ThisWorkbook.SlicerCaches
oSliceCache.Delete
Next oSliceCache
End Sub
Sub Refresh_All_PivotTables()
Dim sheet As Worksheet
Dim PT As PivotTable
For Each sheet In ThisWorkbook.Worksheets
For Each PT In sheet.PivotTables
PT.RefreshTable
'PT.Update
Next PT
Next sheet
End Sub
Sub Add_Slicers()
Dim oSliceCache As SlicerCache
Dim PT As PivotTable
Dim test As String
Sheets("InputData").Select
ActiveWorkbook.SlicerCaches.Add(ActiveSheet.PivotTables("InputData_PivotTable1"), _
"Release").Slicers.Add ActiveSheet, , "SRelease", "All Releases", 165.75, 441, 144, _
198.75
ActiveWorkbook.SlicerCaches.Add(ActiveSheet.PivotTables("InputData_PivotTable1"), _
"Sprint").Slicers.Add ActiveSheet, , "SSprint", "Sprints", 165.75, 441, 144, _
198.75
ActiveWorkbook.SlicerCaches("Slicer_Release").PivotTables.AddPivotTable (ActiveSheet.PivotTables("InputData_PivotTable1"))
'ActiveWorkbook.SlicerCaches("Slicer_Release").PivotTables.AddPivotTable (ActiveSheet.PivotTables("InputData_PivotTable3"))
ActiveWorkbook.SlicerCaches("Slicer_Release").PivotTables.AddPivotTable (ActiveSheet.PivotTables("InputData_PivotTable4"))
'ActiveWorkbook.SlicerCaches("Slicer_Release").PivotTables.AddPivotTable (ActiveSheet.PivotTables("InputData_PivotTable14"))
ActiveWorkbook.SlicerCaches("Slicer_Release").PivotTables.AddPivotTable (ActiveSheet.PivotTables("InputData_PivotTable5"))
ActiveWorkbook.SlicerCaches("Slicer_Sprint").PivotTables.AddPivotTable (ActiveSheet.PivotTables("InputData_PivotTable1"))
'ActiveWorkbook.SlicerCaches("Slicer_Sprint").PivotTables.AddPivotTable (ActiveSheet.PivotTables("InputData_PivotTable3"))
ActiveWorkbook.SlicerCaches("Slicer_Sprint").PivotTables.AddPivotTable (ActiveSheet.PivotTables("InputData_PivotTable4"))
'ActiveWorkbook.SlicerCaches("Slicer_Sprint").PivotTables.AddPivotTable (ActiveSheet.PivotTables("InputData_PivotTable14"))
ActiveWorkbook.SlicerCaches("Slicer_Sprint").PivotTables.AddPivotTable (ActiveSheet.PivotTables("InputData_PivotTable5"))
ActiveSheet.Shapes.Range(Array("SRelease")).Select
Selection.Cut
Range("K69").Select
ActiveSheet.Paste
ActiveSheet.Shapes.Range(Array("SSprint")).Select
Selection.Cut
Range("M69").Select
ActiveSheet.Paste
Sheets("Release Report").Select
ActiveWorkbook.SlicerCaches.Add(ActiveSheet.PivotTables("Release_PivotTable8"), _
"Release").Slicers.Add ActiveSheet, , "RRelease", "Reported Release", 165.75, 441, 144, _
198.75
ActiveWorkbook.SlicerCaches("Slicer_Release1").PivotTables.AddPivotTable (ActiveSheet.PivotTables("Release_PivotTable9"))
ActiveWorkbook.SlicerCaches("Slicer_Release1").PivotTables.AddPivotTable (ActiveSheet.PivotTables("Release_PivotTable7"))
ActiveWorkbook.SlicerCaches("Slicer_Release1").PivotTables.AddPivotTable (ActiveSheet.PivotTables("Release_PivotTable6"))
'ActiveWorkbook.SlicerCaches("Slicer_Release1").PivotTables.AddPivotTable (ActiveSheet.PivotTables("Release_PivotTable4"))
ActiveSheet.Shapes.Range(Array("RRelease")).Select
Selection.Cut
Range("H5").Select
ActiveSheet.Paste
End Sub
Sub UpdateReleaseTable()
Dim tb As ListObject
Dim flag As Integer
Dim rowinsert As String
Dim j As Integer
Dim test As String
Dim sprinttb As ListObject
Dim defsumtb As ListObject
Dim defcattb As ListObject
flag = 0
ActiveWorkbook.Sheets("InputData").Activate
Set tb = ActiveSheet.ListObjects("Table6")
Set sprinttb = ActiveSheet.ListObjects("Table11")
Set defsumtb = ActiveSheet.ListObjects("Table9")
Set defcattb = ActiveSheet.ListObjects("Table3")
For i = 1 To tb.Range.Rows.Count
If Not tb.DataBodyRange Is Nothing Then
If tb.DataBodyRange.Cells(i, 1).Value = sprinttb.DataBodyRange.Cells(1, 2).Value Then
If tb.DataBodyRange.Cells(i, 2).Value = sprinttb.DataBodyRange.Cells(2, 2).Value Then
flag = 1
Exit For
End If
End If
End If
Next
If flag = 1 Then
If MsgBox("This sprint data is already available in release table;" & vbNewLine & "Would you like to overwrite it?", vbOKCancel, "Warning Message") = vbCancel Then
Exit Sub
Else
tb.DataBodyRange.Cells(i, 3) = sprinttb.DataBodyRange.Cells(3, 2)
tb.DataBodyRange.Cells(i, 4) = sprinttb.DataBodyRange.Cells(4, 2)
tb.DataBodyRange.Cells(i, 5) = sprinttb.DataBodyRange.Cells(5, 2)
tb.DataBodyRange.Cells(i, 6) = sprinttb.DataBodyRange.Cells(6, 2)
tb.DataBodyRange.Cells(i, 7) = sprinttb.DataBodyRange.Cells(7, 2)
tb.DataBodyRange.Cells(i, 8) = sprinttb.DataBodyRange.Cells(8, 2)
tb.DataBodyRange.Cells(i, 9) = sprinttb.DataBodyRange.Cells(9, 2)
tb.DataBodyRange.Cells(i, 10) = sprinttb.DataBodyRange.Cells(10, 2)
tb.DataBodyRange.Cells(i, 11) = sprinttb.DataBodyRange.Cells(11, 2)
tb.DataBodyRange.Cells(i, 12) = sprinttb.DataBodyRange.Cells(13, 2)
tb.DataBodyRange.Cells(i, 13) = sprinttb.DataBodyRange.Cells(14, 2)
tb.DataBodyRange.Cells(i, 14) = sprinttb.DataBodyRange.Cells(15, 2)
tb.DataBodyRange.Cells(i, 15) = sprinttb.DataBodyRange.Cells(16, 2)
tb.DataBodyRange.Cells(i, 16) = sprinttb.DataBodyRange.Cells(17, 2)
tb.DataBodyRange.Cells(i, 17) = defsumtb.DataBodyRange.Cells(1, 2)
tb.DataBodyRange.Cells(i, 18) = defsumtb.DataBodyRange.Cells(2, 2)
tb.DataBodyRange.Cells(i, 19) = defsumtb.DataBodyRange.Cells(3, 2)
tb.DataBodyRange.Cells(i, 20) = defsumtb.DataBodyRange.Cells(4, 2)
tb.DataBodyRange.Cells(i, 21) = defsumtb.DataBodyRange.Cells(1, 3)
tb.DataBodyRange.Cells(i, 22) = defsumtb.DataBodyRange.Cells(2, 3)
tb.DataBodyRange.Cells(i, 23) = defsumtb.DataBodyRange.Cells(3, 3)
tb.DataBodyRange.Cells(i, 24) = defsumtb.DataBodyRange.Cells(4, 3)
tb.DataBodyRange.Cells(i, 25) = defsumtb.DataBodyRange.Cells(1, 4)
tb.DataBodyRange.Cells(i, 26) = defsumtb.DataBodyRange.Cells(2, 4)
tb.DataBodyRange.Cells(i, 27) = defsumtb.DataBodyRange.Cells(3, 4)
tb.DataBodyRange.Cells(i, 28) = defsumtb.DataBodyRange.Cells(4, 4)
tb.DataBodyRange.Cells(i, 29) = defsumtb.DataBodyRange.Cells(1, 5)
tb.DataBodyRange.Cells(i, 30) = defsumtb.DataBodyRange.Cells(2, 5)
tb.DataBodyRange.Cells(i, 31) = defsumtb.DataBodyRange.Cells(3, 5)
tb.DataBodyRange.Cells(i, 32) = defsumtb.DataBodyRange.Cells(4, 5)
tb.DataBodyRange.Cells(i, 33) = defsumtb.DataBodyRange.Cells(1, 6)
tb.DataBodyRange.Cells(i, 34) = defsumtb.DataBodyRange.Cells(2, 6)
tb.DataBodyRange.Cells(i, 35) = defsumtb.DataBodyRange.Cells(3, 6)
tb.DataBodyRange.Cells(i, 36) = defsumtb.DataBodyRange.Cells(4, 6)
tb.DataBodyRange.Cells(i, 37) = defcattb.DataBodyRange.Cells(1, 2)
tb.DataBodyRange.Cells(i, 38) = defcattb.DataBodyRange.Cells(2, 2)
tb.DataBodyRange.Cells(i, 39) = defcattb.DataBodyRange.Cells(3, 2)
tb.DataBodyRange.Cells(i, 40) = defcattb.DataBodyRange.Cells(4, 2)
tb.DataBodyRange.Cells(i, 41) = defcattb.DataBodyRange.Cells(5, 2)
tb.DataBodyRange.Cells(i, 42) = defcattb.DataBodyRange.Cells(6, 2)
tb.DataBodyRange.Cells(i, 43) = defcattb.DataBodyRange.Cells(7, 2)
tb.DataBodyRange.Cells(i, 44) = defcattb.DataBodyRange.Cells(8, 2)
tb.DataBodyRange.Cells(i, 45) = defcattb.DataBodyRange.Cells(9, 2)
tb.DataBodyRange.Cells(i, 46) = defcattb.DataBodyRange.Cells(10, 2)
tb.DataBodyRange.Cells(i, 47) = defcattb.DataBodyRange.Cells(11, 2)
tb.DataBodyRange.Cells(i, 48) = defcattb.DataBodyRange.Cells(12, 2)
tb.DataBodyRange.Cells(i, 49) = defcattb.DataBodyRange.Cells(13, 2)
tb.DataBodyRange.Cells(i, 50) = defcattb.DataBodyRange.Cells(14, 2)
tb.DataBodyRange.Cells(i, 52) = sprinttb.DataBodyRange.Cells(12, 2)
tb.DataBodyRange.Cells(i, 51) = sprinttb.DataBodyRange.Cells(18, 2)
tb.DataBodyRange.Cells(i, 53) = sprinttb.DataBodyRange.Cells(20, 2)
ActiveWorkbook.Save
End If
ElseIf flag = 0 Then
i = tb.Range.Rows.Count
If Not tb.DataBodyRange Is Nothing Then
rowinsert = tb.DataBodyRange.Cells(i + 1, 1).Address
ActiveWorkbook.Sheets("InputData").Range(rowinsert).Offset(0, -2).Select
Selection.EntireRow.Insert , CopyOrigin:=xlFormatFromLeftOrAbove
End If
tb.DataBodyRange.Cells(i, 1) = sprinttb.DataBodyRange.Cells(1, 2)
tb.DataBodyRange.Cells(i, 2) = sprinttb.DataBodyRange.Cells(2, 2)
tb.DataBodyRange.Cells(i, 3) = sprinttb.DataBodyRange.Cells(3, 2)
tb.DataBodyRange.Cells(i, 4) = sprinttb.DataBodyRange.Cells(4, 2)
tb.DataBodyRange.Cells(i, 5) = sprinttb.DataBodyRange.Cells(5, 2)
tb.DataBodyRange.Cells(i, 6) = sprinttb.DataBodyRange.Cells(6, 2)
tb.DataBodyRange.Cells(i, 7) = sprinttb.DataBodyRange.Cells(7, 2)
tb.DataBodyRange.Cells(i, 8) = sprinttb.DataBodyRange.Cells(8, 2)
tb.DataBodyRange.Cells(i, 9) = sprinttb.DataBodyRange.Cells(9, 2)
tb.DataBodyRange.Cells(i, 10) = sprinttb.DataBodyRange.Cells(10, 2)
tb.DataBodyRange.Cells(i, 11) = sprinttb.DataBodyRange.Cells(11, 2)
tb.DataBodyRange.Cells(i, 12) = sprinttb.DataBodyRange.Cells(13, 2)
tb.DataBodyRange.Cells(i, 13) = sprinttb.DataBodyRange.Cells(14, 2)
tb.DataBodyRange.Cells(i, 14) = sprinttb.DataBodyRange.Cells(15, 2)
tb.DataBodyRange.Cells(i, 15) = sprinttb.DataBodyRange.Cells(16, 2)
tb.DataBodyRange.Cells(i, 16) = sprinttb.DataBodyRange.Cells(17, 2)
tb.DataBodyRange.Cells(i, 17) = defsumtb.DataBodyRange.Cells(1, 2)
tb.DataBodyRange.Cells(i, 18) = defsumtb.DataBodyRange.Cells(2, 2)
tb.DataBodyRange.Cells(i, 19) = defsumtb.DataBodyRange.Cells(3, 2)
tb.DataBodyRange.Cells(i, 20) = defsumtb.DataBodyRange.Cells(4, 2)
tb.DataBodyRange.Cells(i, 21) = defsumtb.DataBodyRange.Cells(1, 3)
tb.DataBodyRange.Cells(i, 22) = defsumtb.DataBodyRange.Cells(2, 3)
tb.DataBodyRange.Cells(i, 23) = defsumtb.DataBodyRange.Cells(3, 3)
tb.DataBodyRange.Cells(i, 24) = defsumtb.DataBodyRange.Cells(4, 3)
tb.DataBodyRange.Cells(i, 25) = defsumtb.DataBodyRange.Cells(1, 4)
tb.DataBodyRange.Cells(i, 26) = defsumtb.DataBodyRange.Cells(2, 4)
tb.DataBodyRange.Cells(i, 27) = defsumtb.DataBodyRange.Cells(3, 4)
tb.DataBodyRange.Cells(i, 28) = defsumtb.DataBodyRange.Cells(4, 4)
tb.DataBodyRange.Cells(i, 29) = defsumtb.DataBodyRange.Cells(1, 5)
tb.DataBodyRange.Cells(i, 30) = defsumtb.DataBodyRange.Cells(2, 5)
tb.DataBodyRange.Cells(i, 31) = defsumtb.DataBodyRange.Cells(3, 5)
tb.DataBodyRange.Cells(i, 32) = defsumtb.DataBodyRange.Cells(4, 5)
tb.DataBodyRange.Cells(i, 33) = defsumtb.DataBodyRange.Cells(1, 6)
tb.DataBodyRange.Cells(i, 34) = defsumtb.DataBodyRange.Cells(2, 6)
tb.DataBodyRange.Cells(i, 35) = defsumtb.DataBodyRange.Cells(3, 6)
tb.DataBodyRange.Cells(i, 36) = defsumtb.DataBodyRange.Cells(4, 6)
tb.DataBodyRange.Cells(i, 37) = defcattb.DataBodyRange.Cells(1, 2)
tb.DataBodyRange.Cells(i, 38) = defcattb.DataBodyRange.Cells(2, 2)
tb.DataBodyRange.Cells(i, 39) = defcattb.DataBodyRange.Cells(3, 2)
tb.DataBodyRange.Cells(i, 40) = defcattb.DataBodyRange.Cells(4, 2)
tb.DataBodyRange.Cells(i, 41) = defcattb.DataBodyRange.Cells(5, 2)
tb.DataBodyRange.Cells(i, 42) = defcattb.DataBodyRange.Cells(6, 2)
tb.DataBodyRange.Cells(i, 43) = defcattb.DataBodyRange.Cells(7, 2)
tb.DataBodyRange.Cells(i, 44) = defcattb.DataBodyRange.Cells(8, 2)
tb.DataBodyRange.Cells(i, 45) = defcattb.DataBodyRange.Cells(9, 2)
tb.DataBodyRange.Cells(i, 46) = defcattb.DataBodyRange.Cells(10, 2)
tb.DataBodyRange.Cells(i, 47) = defcattb.DataBodyRange.Cells(11, 2)
tb.DataBodyRange.Cells(i, 48) = defcattb.DataBodyRange.Cells(12, 2)
tb.DataBodyRange.Cells(i, 49) = defcattb.DataBodyRange.Cells(13, 2)
tb.DataBodyRange.Cells(i, 50) = defcattb.DataBodyRange.Cells(14, 2)
tb.DataBodyRange.Cells(i, 52) = sprinttb.DataBodyRange.Cells(12, 2)
tb.DataBodyRange.Cells(i, 51) = sprinttb.DataBodyRange.Cells(18, 2)
tb.DataBodyRange.Cells(i, 53) = sprinttb.DataBodyRange.Cells(20, 2)
ActiveWorkbook.Save
End If
End Sub