Hi, I have a piece of code below which goes through a workbook selecting a range from a pivot table and exporting it to specific sheets. The code is very long and time consuming to change. I have several codes similar to this format too. Is there a way of looping to select each publication in turn and export with one Looping function?

Sub Specialist_Top50()

    Sheets("pivot").Select
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Publication")
        .PivotItems("AGN").Visible = True
        .PivotItems("AGS").Visible = False
        .PivotItems("AGW").Visible = False
        .PivotItems("BPI").Visible = False
        .PivotItems("CNB").Visible = False
        .PivotItems("EGK").Visible = False
        .PivotItems("EGS").Visible = False
        .PivotItems("EHK").Visible = False
        .PivotItems("EHS").Visible = False
        .PivotItems("FPN").Visible = False
        .PivotItems("FRA").Visible = False
        .PivotItems("HUK").Visible = False
        .PivotItems("HUS").Visible = False
        .PivotItems("LFN").Visible = False
        .PivotItems("PHM").Visible = False
        .PivotItems("PIL").Visible = False
        .PivotItems("PPH").Visible = False
        .PivotItems("SPD").Visible = False
        .PivotItems("SSH").Visible = False
        .PivotItems("(blank)").Visible = False
    End With
    Range("B5:t5").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    Sheets("AGN").Select
    Range("a3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
        Range("A2:S2000").Sort Key1:=Range("D2"), Order1:=xlDescending, Header:= _
        xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
    Sheets("pivot").Select

    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Publication")
        .PivotItems("AGS").Visible = True
        .PivotItems("AGN").Visible = False
        
    End With
    Range("B5").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range("B5:t5").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("AGS").Select
    Range("a3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
            Range("A2:S2000").Sort Key1:=Range("D2"), Order1:=xlDescending, Header:= _
        xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
    Sheets("pivot").Select
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Publication")
        .PivotItems("AGW").Visible = True
        .PivotItems("AGS").Visible = False
        
    End With
    Range("B5:t5").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("AGW").Select
    Range("a3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
            Range("A2:S2000").Sort Key1:=Range("D2"), Order1:=xlDescending, Header:= _
        xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
    Sheets("pivot").Select
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Publication")
        .PivotItems("BPI").Visible = True
        .PivotItems("AGW").Visible = False
        
    End With
    Range("B5:t5").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("BPI").Select
    Range("a3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
            Range("A2:S2000").Sort Key1:=Range("D2"), Order1:=xlDescending, Header:= _
        xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
    Sheets("pivot").Select
    ActiveWindow.SmallScroll Down:=-21
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Publication")
        .PivotItems("CNB").Visible = True
        .PivotItems("BPI").Visible = False
        
    End With
    Range("B5:t5").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("CNB").Select
    Range("a3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
            Range("A2:S2000").Sort Key1:=Range("D2"), Order1:=xlDescending, Header:= _
        xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
    Sheets("pivot").Select
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Publication")
        .PivotItems("EGK").Visible = True
        .PivotItems("EGS").Visible = True
        .PivotItems("CNB").Visible = False
        
    End With
    Range("B5:t5").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("EGK").Select
    Range("a3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
            Range("A2:S2000").Sort Key1:=Range("D2"), Order1:=xlDescending, Header:= _
        xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
    Sheets("pivot").Select
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Publication")
        .PivotItems("EHK").Visible = True
        .PivotItems("EHS").Visible = True
        .PivotItems("EGK").Visible = False
        .PivotItems("EGS").Visible = False
        
    End With
    
    Range("B5:t5").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("EHK").Select
    Range("a3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
            Range("A2:S2000").Sort Key1:=Range("D2"), Order1:=xlDescending, Header:= _
        xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
    Sheets("pivot").Select
    ActiveWindow.SmallScroll Down:=-24
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Publication")
        .PivotItems("huk").Visible = True
        .PivotItems("hus").Visible = True
        .PivotItems("EHK").Visible = False
        .PivotItems("EHS").Visible = False
        
    End With
    
    Range("B5:t5").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("huk").Select
    Range("a3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
            Range("A2:S2000").Sort Key1:=Range("D2"), Order1:=xlDescending, Header:= _
        xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
    Sheets("pivot").Select
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Publication")
        .PivotItems("FPN").Visible = True
        .PivotItems("huk").Visible = False
        .PivotItems("hus").Visible = False
        
        
    End With
    Range("B5:t5").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("FPN").Select
    Range("a3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
            Range("A2:S2000").Sort Key1:=Range("D2"), Order1:=xlDescending, Header:= _
        xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
    Sheets("pivot").Select
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Publication")
        .PivotItems("FRA").Visible = True
        .PivotItems("FPN").Visible = False
        
    End With
    Range("B5:t5").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("FRA").Select
    Range("a3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
            Range("A2:S2000").Sort Key1:=Range("D2"), Order1:=xlDescending, Header:= _
        xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
    Sheets("pivot").Select
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Publication")
        .PivotItems("LFN").Visible = True
        .PivotItems("FRA").Visible = False
  
    End With
    Range("B5:t5").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("LFN").Select
    Range("a3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
            Range("A2:S2000").Sort Key1:=Range("D2"), Order1:=xlDescending, Header:= _
        xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
    Sheets("pivot").Select
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Publication")
        .PivotItems("PHM").Visible = True
        .PivotItems("LFN").Visible = False
        
    End With


    'etc.....
        
End Sub