Error Excel makro (VBA) Körfel nr '1004'
Hej!
Har ett Excel makro som fungerat felfritt i Office 2003 men nu när det behöver användas i nyare Office 2008 och 2010 blir det körfel nr 1004: "Kunde inte hitta PivotItems egenskapen för PivotField klassen". Vad beror detta på? Är inte tillräckligt duktig på vba/vb för att lösa problemet.
Koden är som följer: (Sorry fall jag ger er scroll kramp )
Sub Stavningsanalys()
ActiveSheet.Unprotect
' Pivot 2
Sheets("Mall").Select
Range("A1").Select
ActiveWindow.LargeScroll Down:=3
Range("A1:V91").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _
"Mall!R1C1:R91C22", TableDestination:="", TableName:= _
"Pivottabell2"
' Pivot 2
' Start ng-ljudet
With ActiveSheet.PivotTables("Pivottabell2").PivotFields("bng")
.PivotItems("(tom)").Visible = False
End With
With ActiveSheet.PivotTables("Pivottabell2").PivotFields("ng-ljud")
.PivotItems("(tom)").Visible = False
End With
ActiveSheet.PivotTables("Pivottabell2").AddFields RowFields:="ng-ljud", _
ColumnFields:="bng"
ActiveSheet.PivotTables("Pivottabell2").PivotFields("ng-ljud"). _
Orientation = xlDataField
Columns("A:F").Select
With Selection.Font
.Name = "Geneva"
.FontStyle = "Normal"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlNone
.ColorIndex = xlAutomatic
End With
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("B1").Select
ActiveCell.FormulaR1C1 = "NG"
Range("C1").Select
ActiveCell.FormulaR1C1 = "G"
Range("D1").Select
ActiveCell.FormulaR1C1 = "N"
Range("E1").Select
ActiveCell.FormulaR1C1 = "N"
Range("A1").Select
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("B1").Select
ActiveCell.FormulaR1C1 = "švriga"
Range("C1").Select
ActiveCell.FormulaR1C1 = "fšre n"
Range("D1").Select
ActiveCell.FormulaR1C1 = "fšre g"
Range("E1").Select
ActiveCell.FormulaR1C1 = "fšre k"
Range("B2").Select
Columns("B:F").Select
Selection.ColumnWidth = 7
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
Range("A1").Select
ActiveSheet.Name = "NG"
' Stopp NG-ljudet
' Pivot 3
Sheets("Mall").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _
"Mall!R1C1:R91C22", TableDestination:="", TableName:= _
"Pivottabell3"
' Pivot 3
' Start L-ljudet
With ActiveSheet.PivotTables("Pivottabell3").PivotFields("blŒ")
.PivotItems("(tom)").Visible = False
End With
With ActiveSheet.PivotTables("Pivottabell3").PivotFields("lŒngt Œ")
.PivotItems("(tom)").Visible = False
End With
ActiveSheet.PivotTables("Pivottabell3").AddFields RowFields:="lŒngt Œ", _
ColumnFields:="blŒ"
ActiveSheet.PivotTables("Pivottabell3").PivotFields("lŒngt Œ"). _
Orientation = xlDataField
Columns("A:E").Select
With Selection.Font
.Name = "Geneva"
.FontStyle = "Normal"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlNone
.ColorIndex = xlAutomatic
End With
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("B1").Select
ActiveCell.FormulaR1C1 = ""
Range("C1").Select
ActiveCell.FormulaR1C1 = ""
Range("D1").Select
ActiveCell.FormulaR1C1 = "O"
Range("A1").Select
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("B1").Select
ActiveCell.FormulaR1C1 = "enstavigt"
Range("C1").Select
ActiveCell.FormulaR1C1 = "1:a stav"
Range("D1").Select
ActiveCell.FormulaR1C1 = "2:a stav"
Columns("B:E").Select
Selection.ColumnWidth = 7
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
Range("A1").Select
ActiveSheet.Name = "L"
' Stopp L-ljudet
' Pivot 4
Sheets("Mall").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _
"Mall!R1C1:R91C22", TableDestination:="", TableName:= _
"Pivottabell4"
' Pivot 4
' Start K-ljudet
With ActiveSheet.PivotTables("Pivottabell4").PivotFields("bkŒ")
.PivotItems("(tom)").Visible = False
End With
With ActiveSheet.PivotTables("Pivottabell4").PivotFields("kort Œ")
.PivotItems("(tom)").Visible = False
End With
ActiveSheet.PivotTables("Pivottabell4").AddFields RowFields:="kort Œ", _
ColumnFields:="bkŒ"
ActiveSheet.PivotTables("Pivottabell4").PivotFields("kort Œ"). _
Orientation = xlDataField
Columns("A:G").Select
With Selection.Font
.Name = "Geneva"
.FontStyle = "Normal"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlNone
.ColorIndex = xlAutomatic
End With
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("B1").Select
ActiveCell.FormulaR1C1 = "O"
Range("C1").Select
ActiveCell.FormulaR1C1 = "O"
Range("D1").Select
ActiveCell.FormulaR1C1 = "O"
Range("E1").Select
ActiveCell.FormulaR1C1 = "O"
Range("F1").Select
ActiveCell.FormulaR1C1 = "O"
Range("A1").Select
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Range("B1").Select
ActiveCell.FormulaR1C1 = "enstavigt"
Range("C1").Select
ActiveCell.FormulaR1C1 = "1:a stav"
Range("D1").Select
ActiveCell.FormulaR1C1 = "1:a stav"
Range("E1").Select
ActiveCell.FormulaR1C1 = "2:a stav"
Range("F1").Select
ActiveCell.FormulaR1C1 = "2:a stav"
Range("B2").Select
ActiveCell.FormulaR1C1 = ""
Range("C2").Select
ActiveCell.FormulaR1C1 = "betonad"
Range("D2").Select
ActiveCell.FormulaR1C1 = "obetonad"
Range("E2").Select
ActiveCell.FormulaR1C1 = "betonad"
Range("F2").Select
ActiveCell.FormulaR1C1 = "obetonad"
Columns("B:G").Select
Selection.ColumnWidth = 7
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
Range("A1").Select
ActiveSheet.Name = "K"
' Stopp K-ljudet
' Pivot 5
Sheets("Mall").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _
"Mall!R1C1:R91C22", TableDestination:="", TableName:= _
"Pivottabell5"
' Pivot 5
' Start L€-ljudet
With ActiveSheet.PivotTables("Pivottabell5").PivotFields("blŠ")
.PivotItems("(tom)").Visible = False
End With
With ActiveSheet.PivotTables("Pivottabell5").PivotFields("lŒngt Š")
.PivotItems("(tom)").Visible = False
End With
ActiveSheet.PivotTables("Pivottabell5").AddFields RowFields:="lŒngt Š", _
ColumnFields:="blŠ"
ActiveSheet.PivotTables("Pivottabell5").PivotFields("lŒngt Š"). _
Orientation = xlDataField
Columns("A:E").Select
With Selection.Font
.Name = "Geneva"
.FontStyle = "Normal"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlNone
.ColorIndex = xlAutomatic
End With
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("B1").Select
ActiveCell.FormulaR1C1 = "€"
Range("C1").Select
ActiveCell.FormulaR1C1 = "€"
Range("D1").Select
ActiveCell.FormulaR1C1 = "€"
Range("A1").Select
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("B1").Select
ActiveCell.FormulaR1C1 = "enstavigt"
Range("C1").Select
ActiveCell.FormulaR1C1 = "1:a stav"
Range("D1").Select
ActiveCell.FormulaR1C1 = "2:a stav"
Columns("B:E").Select
Selection.ColumnWidth = 7
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
Range("A1").Select
ActiveSheet.Name = "L€"
' Stopp L€-ljudet
' Pivot 6
Sheets("Mall").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _
"Mall!R1C1:R91C22", TableDestination:="", TableName:= _
"Pivottabell6"
' Pivot 6
' Start K€-ljudet
With ActiveSheet.PivotTables("Pivottabell6").PivotFields("bkŠ")
.PivotItems("(tom)").Visible = False
End With
With ActiveSheet.PivotTables("Pivottabell6").PivotFields("kort Š")
.PivotItems("(tom)").Visible = False
End With
ActiveSheet.PivotTables("Pivottabell6").AddFields RowFields:="kort Š", _
ColumnFields:="bkŠ"
ActiveSheet.PivotTables("Pivottabell6").PivotFields("kort Š"). _
Orientation = xlDataField
Columns("A:G").Select
With Selection.Font
.Name = "Geneva"
.FontStyle = "Normal"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlNone
.ColorIndex = xlAutomatic
End With
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("B1").Select
ActiveCell.FormulaR1C1 = "€"
Range("C1").Select
ActiveCell.FormulaR1C1 = "€"
Range("D1").Select
ActiveCell.FormulaR1C1 = "E"
Range("E1").Select
ActiveCell.FormulaR1C1 = "E"
Range("F1").Select
ActiveCell.FormulaR1C1 = "E"
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Range("B1").Select
ActiveCell.FormulaR1C1 = "enstavigt"
Range("C1").Select
ActiveCell.FormulaR1C1 = "1:a stav"
Range("D1").Select
ActiveCell.FormulaR1C1 = "1:a stav"
Range("E1").Select
ActiveCell.FormulaR1C1 = "2:a stav"
Range("F1").Select
ActiveCell.FormulaR1C1 = "2:a stav"
Range("B2").Select
ActiveCell.FormulaR1C1 = ""
Range("C2").Select
ActiveCell.FormulaR1C1 = "betonad"
Range("D2").Select
ActiveCell.FormulaR1C1 = "obetonad"
Range("E2").Select
ActiveCell.FormulaR1C1 = "betonad"
Range("F2").Select
ActiveCell.FormulaR1C1 = "obetonad"
Columns("B:G").Select
Selection.ColumnWidth = 7
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
Range("A1").Select
ActiveSheet.Name = "K€"
' Stopp K€-ljudet
' Pivot 7
Sheets("Mall").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _
"Mall!R1C1:R91C22", TableDestination:="", TableName:= _
"Pivottabell7"
' Pivot 7
' Start 20-ljudet
With ActiveSheet.PivotTables("Pivottabell7").PivotFields("btj")
.PivotItems("(tom)").Visible = False
End With
With ActiveSheet.PivotTables("Pivottabell7").PivotFields("20-ljud")
.PivotItems("(tom)").Visible = False
End With
ActiveSheet.PivotTables("Pivottabell7").AddFields RowFields:="20-ljud", _
ColumnFields:="btj"
ActiveSheet.PivotTables("Pivottabell7").PivotFields("20-ljud"). _
Orientation = xlDataField
Columns("A:G").Select
With Selection.Font
.Name = "Geneva"
.FontStyle = "Normal"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlNone
.ColorIndex = xlAutomatic
End With
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("B1").Select
ActiveCell.FormulaR1C1 = "K"
Range("C1").Select
ActiveCell.FormulaR1C1 = "K"
Range("D1").Select
ActiveCell.FormulaR1C1 = "K"
Range("E1").Select
ActiveCell.FormulaR1C1 = "TJ"
Range("F1").Select
ActiveCell.FormulaR1C1 = "TJ"
Range("A1").Select
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Range("B1").Select
ActiveCell.FormulaR1C1 = "enstavigt"
Range("C1").Select
ActiveCell.FormulaR1C1 = "1:a beton"
Range("D1").Select
ActiveCell.FormulaR1C1 = "1:a obeton"
Range("E1").Select
ActiveCell.FormulaR1C1 = "enstavigt"
Range("F1").Select
ActiveCell.FormulaR1C1 = "1:a beton"
Range("B2").Select
ActiveCell.FormulaR1C1 = "mjuk efter"
Range("C2").Select
ActiveCell.FormulaR1C1 = "mjuk efter"
Range("D2").Select
ActiveCell.FormulaR1C1 = "mjuk efter"
Range("E2").Select
ActiveCell.FormulaR1C1 = "hŒrd efter"
Range("F2").Select
ActiveCell.FormulaR1C1 = "hŒrd efter"
Columns("B:G").Select
Selection.ColumnWidth = 9
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
Range("A1").Select
ActiveSheet.Name = "20"
' Stopp 20-ljudet
' Pivot 8
Sheets("Mall").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _
"Mall!R1C1:R91C22", TableDestination:="", TableName:= _
"Pivottabell8"
' Pivot 8
' Start J-ljudet
With ActiveSheet.PivotTables("Pivottabell8").PivotFields("bj")
.PivotItems("(tom)").Visible = False
End With
With ActiveSheet.PivotTables("Pivottabell8").PivotFields("j-ljud")
.PivotItems("(tom)").Visible = False
End With
ActiveSheet.PivotTables("Pivottabell8").AddFields RowFields:="j-ljud", _
ColumnFields:="bj"
ActiveSheet.PivotTables("Pivottabell8").PivotFields("j-ljud"). _
Orientation = xlDataField
Columns("A:J").Select
With Selection.Font
.Name = "Geneva"
.FontStyle = "Normal"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlNone
.ColorIndex = xlAutomatic
End With
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Columns("B:J").Select
Selection.ColumnWidth = 7
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
Range("B1").Select
ActiveCell.FormulaR1C1 = "onset"
Range("G1").Select
ActiveCell.FormulaR1C1 = "coda"
Range("B2").Select
ActiveCell.FormulaR1C1 = "1:a stav o enstav"
Range("E2").Select
ActiveCell.FormulaR1C1 = "2:a stav"
Range("G2").Select
ActiveCell.FormulaR1C1 = "enstav"
Range("I2").Select
ActiveCell.FormulaR1C1 = "flerstav"
Range("B3").Select
ActiveCell.FormulaR1C1 = "bara O1"
Range("D3").Select
ActiveCell.FormulaR1C1 = "OxO1"
Range("E3").Select
ActiveCell.FormulaR1C1 = "OxO1"
Range("F3").Select
ActiveCell.FormulaR1C1 = "bara O1"
Range("G3").Select
ActiveCell.FormulaR1C1 = "C1"
Range("H3").Select
ActiveCell.FormulaR1C1 = "C2"
Range("B4").Select
ActiveCell.FormulaR1C1 = "mjuk eft"
Range("C4").Select
ActiveCell.FormulaR1C1 = "hŒrd eft"
Range("B5").Select
ActiveCell.FormulaR1C1 = "G"
Range("C5").Select
ActiveCell.FormulaR1C1 = "J"
Range("D5").Select
ActiveCell.FormulaR1C1 = "J"
Range("E5").Select
ActiveCell.FormulaR1C1 = "I"
Range("F5").Select
ActiveCell.FormulaR1C1 = "J"
Range("G5").Select
ActiveCell.FormulaR1C1 = "J"
Range("H5").Select
ActiveCell.FormulaR1C1 = "G"
Range("I5").Select
ActiveCell.FormulaR1C1 = "J"
Range("B1:I5").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
Range("B1:F1").Select
With Selection
.HorizontalAlignment = xlCenterAcrossSelection
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
Range("G1:I1").Select
With Selection
.HorizontalAlignment = xlCenterAcrossSelection
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
Range("B2:D2").Select
With Selection
.HorizontalAlignment = xlCenterAcrossSelection
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
Range("E2:F2").Select
With Selection
.HorizontalAlignment = xlCenterAcrossSelection
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
Range("G2:H2").Select
With Selection
.HorizontalAlignment = xlCenterAcrossSelection
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
Range("B3:C3").Select
With Selection
.HorizontalAlignment = xlCenterAcrossSelection
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
Range("A1").Select
ActiveSheet.Name = "J"
' Stopp J-ljudet
' Pivot 9
Sheets("Mall").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _
"Mall!R1C1:R91C22", TableDestination:="", TableName:= _
"Pivottabell9"
' Pivot 9
' Start 7-ljudet
With ActiveSheet.PivotTables("Pivottabell9").PivotFields("bsj")
.PivotItems("(tom)").Visible = False
End With
With ActiveSheet.PivotTables("Pivottabell9").PivotFields("7-ljud")
.PivotItems("(tom)").Visible = False
End With
ActiveSheet.PivotTables("Pivottabell9").AddFields RowFields:="7-ljud", _
ColumnFields:="bsj"
ActiveSheet.PivotTables("Pivottabell9").PivotFields("7-ljud"). _
Orientation = xlDataField
Columns("A:J").Select
With Selection.Font
.Name = "Geneva"
.FontStyle = "Normal"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlNone
.ColorIndex = xlAutomatic
End With
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("B1").Select
ActiveCell.FormulaR1C1 = "SJ"
Range("C1").Select
ActiveCell.FormulaR1C1 = "SCH"
Range("D1").Select
ActiveCell.FormulaR1C1 = "SK"
Range("E1").Select
ActiveCell.FormulaR1C1 = "TI"
Range("F1").Select
ActiveCell.FormulaR1C1 = "RS"
Range("G1").Select
ActiveCell.FormulaR1C1 = "SCH"
Range("H1").Select
ActiveCell.FormulaR1C1 = "GE"
Range("I1").Select
ActiveCell.FormulaR1C1 = "RS"
Range("A1").Select
ActiveSheet.Name = "7"
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Range("B1").Select
ActiveCell.FormulaR1C1 = "fšrst"
Range("C1").Select
ActiveCell.FormulaR1C1 = "fšrst"
Range("D1").Select
ActiveCell.FormulaR1C1 = "fšrst"
Range("E1").Select
ActiveCell.FormulaR1C1 = "inne"
Range("F1").Select
ActiveCell.FormulaR1C1 = "inne"
Range("G1").Select
ActiveCell.FormulaR1C1 = "sist"
Range("H1").Select
ActiveCell.FormulaR1C1 = "sist"
Range("I1").Select
ActiveCell.FormulaR1C1 = "sist"
Range("B2").Select
ActiveCell.FormulaR1C1 = "h/l eft"
Range("C2").Select
ActiveCell.FormulaR1C1 = "h/k eft"
Range("D2").Select
ActiveCell.FormulaR1C1 = "mjuk eft"
Range("E2").Select
ActiveCell.FormulaR1C1 = "kons fšr"
Range("F2").Select
ActiveCell.FormulaR1C1 = "vok fšr"
Range("G2").Select
ActiveCell.FormulaR1C1 = "kons fšr"
Range("H2").Select
ActiveCell.FormulaR1C1 = "lŒng fšr"
Range("I2").Select
ActiveCell.FormulaR1C1 = "kort fšr"
Columns("B:I").Select
Selection.ColumnWidth = 6
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
Range("A1").Select
' Stopp 7-ljudet
' Pivot dubbelteckning
Sheets("Mall").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _
"Mall!R1C1:R91C22", TableDestination:="", TableName:= _
"Pivottabell10"
ActiveSheet.PivotTables("Pivottabell10").AddFields RowFields:="dt stav 1", _
ColumnFields:="dt1"
ActiveSheet.PivotTables("Pivottabell10").PivotFields("dt stav 1"). _
Orientation = xlDataField
Columns("A:J").Select
With Selection.Font
.Name = "Geneva"
.FontStyle = "Normal"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlNone
.ColorIndex = xlAutomatic
End With
ActiveSheet.Name = "Dt1"
Columns("B:K").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
Range("A1").Select
Sheets("Mall").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _
"Mall!R1C1:R91C22", TableDestination:="", TableName:= _
"Pivottabell11"
' Start Dt2-ljudet
With ActiveSheet.PivotTables("Pivottabell11").PivotFields("dt2")
.PivotItems("(tom)").Visible = False
End With
With ActiveSheet.PivotTables("Pivottabell11").PivotFields("dt stav 2")
.PivotItems("(tom)").Visible = False
End With
ActiveSheet.PivotTables("Pivottabell11").AddFields RowFields:="dt stav 2", _
ColumnFields:="dt2"
ActiveSheet.PivotTables("Pivottabell11").PivotFields("dt stav 2"). _
Orientation = xlDataField
Columns("A:K").Select
With Selection.Font
.Name = "Geneva"
.FontStyle = "Normal"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlNone
.ColorIndex = xlAutomatic
End With
ActiveSheet.Name = "Dt2"
Columns("B:J").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = xlHorizontal
End With
Range("A1").Select
Sheets("Mall").Select
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Range("A1").Select
' Stopp Dt2-ljudet
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios _
:=True
End Sub
Excel-filen här: https://www.sugarsync.com/pf/D6177674_9636893_974580