Sub x()
Dim lngRow As Long
Dim pvtTable As PivotTable
Dim blnHasName As Boolean
Set pvtTable = ActiveSheet.PivotTables(1)
With pvtTable.TableRange1
' clear column to right of table
.Columns(1).Offset(, .Columns.Count).Clear
For lngRow = 2 To .Rows.Count
If Right(.Cells(lngRow, 1), 5) = "Total" Then
If blnHasName Then
.Cells(lngRow, 1).Offset(, .Columns.Count).Value = .Cells(lngRow, .Columns.Count).Value
.Cells(lngRow, 1).Offset(, .Columns.Count).Interior.ColorIndex = 39
End If
blnHasName = False
ElseIf InStr(1, .Cells(lngRow, 3), "PIMCO", vbTextCompare) > 0 Then
blnHasName = True
End If
Next
End With
Columns("N:N").Select
Selection.Copy
Columns("O:O").Select
ActiveSheet.Paste
Columns("N:N").Select
Application.CutCopyMode = False
Selection.ClearContents
Selection.Interior.ColorIndex = 2
End Sub
Sub Y()
Dim lngRow As Long
Dim pvtTable As PivotTable
Dim blnHasName As Boolean
Set pvtTable = ActiveSheet.PivotTables(1)
With pvtTable.TableRange1
' clear column to right of table
.Columns(1).Offset(, .Columns.Count).Clear
For lngRow = 1 To .Rows.Count
If Right(.Cells(lngRow, 1), 5) = "Total" Then
If blnHasName Then
.Cells(lngRow, 1).Offset(, .Columns.Count).Value = .Cells(lngRow, .Columns.Count).Value
.Cells(lngRow, 1).Offset(, .Columns.Count).Interior.ColorIndex = 6
End If
blnHasName = False
ElseIf InStr(1, .Cells(lngRow, 3), "Repo", vbTextCompare) > 0 Then
blnHasName = True
End If
Next
End With
End Sub
Sub Deletemove()
Columns("N:N").Select
Range("N16").Activate
Selection.Copy
Columns("O:O").Select
Range("O16").Activate
Selection.Insert Shift:=xlToRight
Columns("N:N").Select
Range("N16").Activate
Application.CutCopyMode = False
Selection.ClearContents
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
End With
End Sub
Sub EmeItalian()
Dim lngRow As Long
Dim pvtTable As PivotTable
Dim blnHasName As Boolean
Set pvtTable = ActiveSheet.PivotTables(1)
With pvtTable.TableRange1
' clear column to right of table
.Columns(1).Offset(, .Columns.Count).Clear
For lngRow = 1 To .Rows.Count
If Right(.Cells(lngRow, 1), 5) = "Total" Then
If blnHasName Then
.Cells(lngRow, 1).Offset(, .Columns.Count).Value = .Cells(lngRow, .Columns.Count).Value
.Cells(lngRow, 1).Offset(, .Columns.Count).Interior.ColorIndex = 3
End If
blnHasName = False
ElseIf InStr(1, .Cells(lngRow, 1), "IT000", vbTextCompare) > 0 Then
blnHasName = True
End If
Next
End With
Columns("K:K").Select
Range("K16").Activate
Selection.Copy
Columns("L:L").Select
Range("L16").Activate
Selection.Insert Shift:=xlToRight
Columns("K:K").Select
Range("K16").Activate
Application.CutCopyMode = False
Selection.ClearContents
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
End With
End Sub
Sub repoemea()
Dim lngRow As Long
Dim pvtTable As PivotTable
Dim blnHasName As Boolean
Set pvtTable = ActiveSheet.PivotTables(1)
With pvtTable.TableRange1
' clear column to right of table
.Columns(1).Offset(, .Columns.Count).Clear
For lngRow = 1 To .Rows.Count
If Right(.Cells(lngRow, 1), 5) = "Total" Then
If blnHasName Then
.Cells(lngRow, 1).Offset(, .Columns.Count).Value = .Cells(lngRow, .Columns.Count).Value
.Cells(lngRow, 1).Offset(, .Columns.Count).Interior.ColorIndex = 36
End If
blnHasName = False
ElseIf InStr(1, .Cells(lngRow, 3), "Repo", vbTextCompare) > 0 Then
blnHasName = True
End If
Next
End With
Columns("K:K").Select
Range("K16").Activate
Selection.Copy
Columns("L:L").Select
Range("L16").Activate
Selection.Insert Shift:=xlToRight
Columns("K:K").Select
Range("K16").Activate
Application.CutCopyMode = False
Selection.ClearContents
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
End With
End Sub
Sub LandGemea()
Dim lngRow As Long
Dim pvtTable As PivotTable
Dim blnHasName As Boolean
Set pvtTable = ActiveSheet.PivotTables(1)
With pvtTable.TableRange1
' clear column to right of table
.Columns(1).Offset(, .Columns.Count).Clear
For lngRow = 1 To .Rows.Count
If Right(.Cells(lngRow, 1), 5) = "Total" Then
If blnHasName Then
.Cells(lngRow, 1).Offset(, .Columns.Count).Value = .Cells(lngRow, .Columns.Count).Value
.Cells(lngRow, 1).Offset(, .Columns.Count).Interior.ColorIndex = 46
End If
blnHasName = False
ElseIf InStr(1, .Cells(lngRow, 3), "LEGAL AND GENERAL", vbTextCompare) > 0 Then
blnHasName = True
ElseIf InStr(1, .Cells(lngRow, 3), "LEGAL & GENERAL", vbTextCompare) > 0 Then
blnHasName = True
End If
Next
End With
Columns("K:K").Select
Range("K16").Activate
Selection.Copy
Columns("L:L").Select
Range("L16").Activate
Selection.Insert Shift:=xlToRight
Columns("K:K").Select
Range("K16").Activate
Application.CutCopyMode = False
Selection.ClearContents
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
End With
End Sub
Sub DanskEmea()
Dim lngRow As Long
Dim pvtTable As PivotTable
Dim blnHasName As Boolean
Set pvtTable = ActiveSheet.PivotTables(1)
With pvtTable.TableRange1
' clear column to right of table
.Columns(1).Offset(, .Columns.Count).Clear
For lngRow = 1 To .Rows.Count
If Right(.Cells(lngRow, 1), 5) = "Total" Then
If blnHasName Then
.Cells(lngRow, 1).Offset(, .Columns.Count).Value = .Cells(lngRow, .Columns.Count).Value
.Cells(lngRow, 1).Offset(, .Columns.Count).Interior.ColorIndex = 45
End If
blnHasName = False
ElseIf InStr(1, .Cells(lngRow, 3), "DANSKE", vbTextCompare) > 0 Then
blnHasName = True
End If
Next
End With
Columns("K:K").Select
Range("K16").Activate
Selection.Copy
Columns("L:L").Select
Range("L16").Activate
Selection.Insert Shift:=xlToRight
Columns("K:K").Select
Range("K16").Activate
Application.CutCopyMode = False
Selection.ClearContents
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
End With
End Sub
Thanks & Regards,
Bookmarks